fix open file logic

pull/982/head
Mikael Finstad 5 years ago
parent 802a701430
commit 53384a8bb3
No known key found for this signature in database
GPG Key ID: 25AB36E3E81CBC26

@ -1680,12 +1680,14 @@ const App = memo(() => {
const isLlcProject = filePathLowerCase.endsWith('.llc'); const isLlcProject = filePathLowerCase.endsWith('.llc');
// If file is already opened, need to ask the user what to do // Need to ask the user what to do if more than one option
if (isFileOpened) { const inputOptions = {};
const inputOptions = { open: i18n.t('Open the file instead of the current one') }; if (isFileOpened) inputOptions.open = i18n.t('Open the file instead of the current one');
if (isLlcProject) inputOptions.project = i18n.t('Load segments from the new file, but keep the current media'); if (isLlcProject) inputOptions.project = i18n.t('Load segments from the new file, but keep the current media');
else inputOptions.tracks = i18n.t('Include all tracks from the new file'); if (isFileOpened && !isLlcProject) inputOptions.tracks = i18n.t('Include all tracks from the new file');
if (batchFiles.length > 0) inputOptions.addToBatch = i18n.t('Add the file to the batch list');
if (Object.keys(inputOptions).length > 0) {
const openFileResponse = enableAskForFileOpenAction ? await askForFileOpenAction(inputOptions) : 'open'; const openFileResponse = enableAskForFileOpenAction ? await askForFileOpenAction(inputOptions) : 'open';
if (openFileResponse === 'open') { if (openFileResponse === 'open') {
@ -1701,6 +1703,10 @@ const App = memo(() => {
setStreamsSelectorShown(true); setStreamsSelectorShown(true);
return; return;
} }
if (openFileResponse === 'addToBatch') {
batchLoadPaths([firstFilePath], true);
return;
}
// Dialog canceled: // Dialog canceled:
return; return;
} }
@ -1716,7 +1722,7 @@ const App = memo(() => {
} finally { } finally {
setWorking(); setWorking();
} }
}, [batchLoadPaths, alwaysConcatMultipleFiles, setWorking, isFileOpened, userOpenSingleFile, checkFileOpened, loadEdlFile, enableAskForFileOpenAction, addStreamSourceFile]); }, [alwaysConcatMultipleFiles, batchLoadPaths, setWorking, batchFiles.length, isFileOpened, userOpenSingleFile, checkFileOpened, loadEdlFile, enableAskForFileOpenAction, addStreamSourceFile]);
const userHtml5ifyCurrentFile = useCallback(async () => { const userHtml5ifyCurrentFile = useCallback(async () => {
if (!filePath) return; if (!filePath) return;

Loading…
Cancel
Save