1
0
mirror of https://github.com/mifi/lossless-cut.git synced 2024-11-26 04:02:51 +01:00

improve save/load project

This commit is contained in:
Mikael Finstad 2020-05-17 13:44:19 +08:00
parent 90c84f1f85
commit fcf1f0561c
2 changed files with 7 additions and 3 deletions

View File

@ -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');
},

View File

@ -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]);