improve save/load project

pull/377/head
Mikael Finstad 6 years ago
parent 90c84f1f85
commit fcf1f0561c

@ -30,13 +30,13 @@ module.exports = (app, mainWindow, newVersion) => {
},
{ type: 'separator' },
{
label: 'Import CSV cut file',
label: 'Load project (CSV)',
click() {
mainWindow.webContents.send('importEdlFile');
},
},
{
label: 'Export CSV cut file',
label: 'Save project (CSV)',
click() {
mainWindow.webContents.send('exportEdlFile');
},

@ -1499,6 +1499,7 @@ const App = memo(() => {
async function exportEdlFile() {
try {
if (!isFileOpened) return;
const { canceled, filePath: fp } = await dialog.showSaveDialog({ defaultPath: `${new Date().getTime()}.csv`, filters: [{ name: i18n.t('CSV files'), extensions: ['csv'] }] });
if (canceled || !fp) return;
if (await exists(fp)) {
@ -1513,7 +1514,10 @@ const App = memo(() => {
}
async function importEdlFile() {
if (!isFileOpened) return;
if (!isFileOpened) {
toast.fire({ icon: 'info', title: i18n.t('You need to open a media file first') });
return;
}
const { canceled, filePaths } = await dialog.showOpenDialog({ properties: ['openFile'], filters: [{ name: i18n.t('CSV files'), extensions: ['csv'] }] });
if (canceled || filePaths.length < 1) return;
await loadEdlFile(filePaths[0]);

Loading…
Cancel
Save