2020-02-26 03:11:28 +00:00
|
|
|
import React, { Fragment, memo } from 'react';
|
2020-02-28 11:00:30 +00:00
|
|
|
import { IoIosHelpCircle, IoIosSettings } from 'react-icons/io';
|
2020-02-26 03:11:28 +00:00
|
|
|
import { Button } from 'evergreen-ui';
|
|
|
|
import { MdCallSplit, MdCallMerge } from 'react-icons/md';
|
2020-03-19 15:37:38 +00:00
|
|
|
import { useTranslation } from 'react-i18next';
|
2020-02-26 03:11:28 +00:00
|
|
|
|
|
|
|
import { withBlur } from './util';
|
|
|
|
|
|
|
|
|
|
|
|
const TopMenu = memo(({
|
2020-04-06 16:08:46 +00:00
|
|
|
filePath, copyAnyAudioTrack, toggleStripAudio, customOutDir, changeOutDir,
|
2020-02-26 03:11:28 +00:00
|
|
|
renderOutFmt, outSegments, autoMerge, toggleAutoMerge, keyframeCut, toggleKeyframeCut, toggleHelp,
|
2020-02-28 11:00:30 +00:00
|
|
|
numStreamsToCopy, numStreamsTotal, setStreamsSelectorShown, toggleSettings,
|
2020-02-26 03:11:28 +00:00
|
|
|
}) => {
|
2020-03-19 15:37:38 +00:00
|
|
|
const { t } = useTranslation();
|
|
|
|
|
2020-02-26 03:11:28 +00:00
|
|
|
const AutoMergeIcon = autoMerge ? MdCallMerge : MdCallSplit;
|
|
|
|
|
|
|
|
return (
|
|
|
|
<Fragment>
|
|
|
|
{filePath && (
|
|
|
|
<Fragment>
|
|
|
|
<Button height={20} iconBefore="list" onClick={withBlur(() => setStreamsSelectorShown(true))}>
|
2020-03-19 15:37:38 +00:00
|
|
|
{t('Tracks')} ({numStreamsToCopy}/{numStreamsTotal})
|
2020-02-26 03:11:28 +00:00
|
|
|
</Button>
|
|
|
|
|
|
|
|
<Button
|
|
|
|
iconBefore={copyAnyAudioTrack ? 'volume-up' : 'volume-off'}
|
|
|
|
height={20}
|
2020-03-19 15:37:38 +00:00
|
|
|
title={`${t('Discard audio? Current:')} ${copyAnyAudioTrack ? t('Keep audio tracks') : t('Discard audio tracks')}`}
|
2020-02-26 03:11:28 +00:00
|
|
|
onClick={withBlur(toggleStripAudio)}
|
|
|
|
>
|
2020-03-19 15:37:38 +00:00
|
|
|
{copyAnyAudioTrack ? t('Keep audio') : t('Discard audio')}
|
2020-02-26 03:11:28 +00:00
|
|
|
</Button>
|
|
|
|
</Fragment>
|
|
|
|
)}
|
|
|
|
|
|
|
|
<div style={{ flexGrow: 1 }} />
|
|
|
|
|
|
|
|
{filePath && (
|
|
|
|
<Fragment>
|
|
|
|
<Button
|
|
|
|
iconBefore={customOutDir ? 'folder-open' : undefined}
|
|
|
|
height={20}
|
2020-04-06 16:08:46 +00:00
|
|
|
onClick={withBlur(changeOutDir)}
|
2020-02-26 03:11:28 +00:00
|
|
|
title={customOutDir}
|
|
|
|
>
|
2020-03-19 15:37:38 +00:00
|
|
|
{customOutDir ? t('Working dir set') : t('Working dir unset')}
|
2020-02-26 03:11:28 +00:00
|
|
|
</Button>
|
|
|
|
|
|
|
|
<div style={{ width: 60 }}>{renderOutFmt({ height: 20 })}</div>
|
|
|
|
|
|
|
|
<Button
|
|
|
|
height={20}
|
|
|
|
style={{ opacity: outSegments && outSegments.length < 2 ? 0.4 : undefined }}
|
2020-03-19 15:37:38 +00:00
|
|
|
title={autoMerge ? t('Auto merge segments to one file after export') : t('Export to separate files')}
|
2020-02-26 03:11:28 +00:00
|
|
|
onClick={withBlur(toggleAutoMerge)}
|
|
|
|
>
|
2020-03-19 15:37:38 +00:00
|
|
|
<AutoMergeIcon /> {autoMerge ? t('Merge cuts') : t('Separate files')}
|
2020-02-26 03:11:28 +00:00
|
|
|
</Button>
|
|
|
|
|
|
|
|
<Button
|
|
|
|
height={20}
|
|
|
|
iconBefore={keyframeCut ? 'key' : undefined}
|
2020-03-19 15:37:38 +00:00
|
|
|
title={`${t('Cut mode is:')} ${keyframeCut ? t('Keyframe cut') : t('Normal cut')}`}
|
2020-02-26 03:11:28 +00:00
|
|
|
onClick={withBlur(toggleKeyframeCut)}
|
|
|
|
>
|
2020-03-19 15:37:38 +00:00
|
|
|
{keyframeCut ? t('Keyframe cut') : t('Normal cut')}
|
2020-02-26 03:11:28 +00:00
|
|
|
</Button>
|
|
|
|
</Fragment>
|
|
|
|
)}
|
|
|
|
|
|
|
|
<IoIosHelpCircle size={24} role="button" onClick={toggleHelp} style={{ verticalAlign: 'middle', marginLeft: 5 }} />
|
2020-02-28 11:00:30 +00:00
|
|
|
<IoIosSettings size={24} role="button" onClick={toggleSettings} style={{ verticalAlign: 'middle', marginLeft: 5 }} />
|
2020-02-26 03:11:28 +00:00
|
|
|
</Fragment>
|
|
|
|
);
|
|
|
|
});
|
|
|
|
|
|
|
|
export default TopMenu;
|