add title to dialogs #1954

pull/2038/head
Mikael Finstad 2024-05-24 17:52:14 +02:00
rodzic 4892437b83
commit 625b696a48
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 25AB36E3E81CBC26
3 zmienionych plików z 11 dodań i 9 usunięć

Wyświetl plik

@ -86,7 +86,7 @@ import { rightBarWidth, leftBarWidth, ffmpegExtractWindow, zoomMax } from './uti
import 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 {

Wyświetl plik

@ -46,9 +46,11 @@ export async function promptTimeOffset({ initialValue, title, text, inputPlaceho
// https://github.com/mifi/lossless-cut/issues/1495
export 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');

Wyświetl plik

@ -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