add title to dialogs #1954

pull/2038/head
Mikael Finstad 1 year ago
parent 4892437b83
commit 625b696a48
No known key found for this signature in database
GPG Key ID: 25AB36E3E81CBC26

@ -86,7 +86,7 @@ import { rightBarWidth, leftBarWidth, ffmpegExtractWindow, zoomMax } from './uti
import BigWaveform from './components/BigWaveform'; import BigWaveform from './components/BigWaveform';
import isDev from './isDev'; 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 { CaptureFormat, KeyboardAction, Html5ifyMode, WaveformMode } from '../../../types';
import { FFprobeChapter, FFprobeFormat, FFprobeStream } from '../../../ffprobe'; import { FFprobeChapter, FFprobeFormat, FFprobeStream } from '../../../ffprobe';
@ -2055,14 +2055,14 @@ function App() {
const showIncludeExternalStreamsDialog = useCallback(async () => { const showIncludeExternalStreamsDialog = useCallback(async () => {
try { 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; const [firstFilePath] = filePaths;
if (canceled || firstFilePath == null) return; if (canceled || firstFilePath == null) return;
await addStreamSourceFile(firstFilePath); await addStreamSourceFile(firstFilePath);
} catch (err) { } catch (err) {
handleError(err); handleError(err);
} }
}, [addStreamSourceFile]); }, [addStreamSourceFile, t]);
const toggleFullscreenVideo = useCallback(async () => { const toggleFullscreenVideo = useCallback(async () => {
if (!screenfull.isEnabled) { if (!screenfull.isEnabled) {
@ -2372,7 +2372,7 @@ function App() {
const onVideoClick = useCallback(() => togglePlay(), [togglePlay]); const onVideoClick = useCallback(() => togglePlay(), [togglePlay]);
useEffect(() => { useEffect(() => {
async function tryExportEdlFile(type) { async function tryExportEdlFile(type: EdlExportType) {
if (!checkFileOpened()) return; if (!checkFileOpened()) return;
try { try {
await exportEdlFile({ type, cutSegments: selectedSegments, customOutDir, filePath, getFrameCount }); 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; if (!checkFileOpened()) return;
try { try {

@ -46,9 +46,11 @@ export async function promptTimeOffset({ initialValue, title, text, inputPlaceho
// https://github.com/mifi/lossless-cut/issues/1495 // https://github.com/mifi/lossless-cut/issues/1495
export const showOpenDialog = async ({ export const showOpenDialog = async ({
filters = isWindows ? [{ name: i18n.t('All Files'), extensions: ['*'] }] : undefined, filters = isWindows ? [{ name: i18n.t('All Files'), extensions: ['*'] }] : undefined,
title,
...props ...props
// @ts-expect-error todo }: Omit<Parameters<typeof dialog.showOpenDialog>[0], 'title'> & { title: string }) => (
}: Parameters<typeof dialog.showOpenDialog>[0]) => dialog.showOpenDialog({ ...props, filters }); dialog.showOpenDialog({ ...props, title, ...(filters != null ? { filters } : {}) })
);
export async function askForYouTubeInput() { export async function askForYouTubeInput() {
const example = i18n.t('YouTube video description\n00:00 Intro\n00:01 Chapter 2\n00:00:02.123 Chapter 3'); const example = i18n.t('YouTube video description\n00:00 Intro\n00:01 Chapter 2\n00:00:02.123 Chapter 3');

@ -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 === 'srt') filters = [{ name: i18n.t('Subtitles (SRT)'), extensions: ['srt'] }];
else if (type === 'llc') filters = [{ name: i18n.t('LosslessCut project'), extensions: ['llc'] }]; 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; const [firstFilePath] = filePaths;
if (canceled || firstFilePath == null) return []; if (canceled || firstFilePath == null) return [];
return readEdlFile({ type, path: firstFilePath, fps }); 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 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; if (canceled || !savePath) return;
console.log('Saving', type, savePath); console.log('Saving', type, savePath);
// eslint-disable-next-line unicorn/prefer-switch // eslint-disable-next-line unicorn/prefer-switch

Loading…
Cancel
Save