1
0
mirror of https://github.com/mifi/lossless-cut.git synced 2024-11-22 18:32:34 +01:00

show progress in title

closes #1417
This commit is contained in:
Mikael Finstad 2023-01-09 12:39:14 +08:00
parent 91bf47eb5c
commit f1a9ea0e1d
No known key found for this signature in database
GPG Key ID: 25AB36E3E81CBC26

View File

@ -97,6 +97,11 @@ const { focusWindow } = remote.require('./electron');
const calcShouldShowWaveform = (zoomedDuration) => (zoomedDuration != null && zoomedDuration < ffmpegExtractWindow * 8); const calcShouldShowWaveform = (zoomedDuration) => (zoomedDuration != null && zoomedDuration < ffmpegExtractWindow * 8);
const calcShouldShowKeyframes = (zoomedDuration) => (zoomedDuration != null && zoomedDuration < ffmpegExtractWindow * 8); const calcShouldShowKeyframes = (zoomedDuration) => (zoomedDuration != null && zoomedDuration < ffmpegExtractWindow * 8);
function setDocumentExtraTitle(extra) {
const baseTitle = 'LosslessCut';
if (extra != null) document.title = `${baseTitle} - ${extra}`;
else document.title = baseTitle;
}
const videoStyle = { width: '100%', height: '100%', objectFit: 'contain' }; const videoStyle = { width: '100%', height: '100%', objectFit: 'contain' };
const bottomMotionStyle = { background: controlsBackground }; const bottomMotionStyle = { background: controlsBackground };
@ -196,6 +201,16 @@ const App = memo(() => {
setWorkingState(val); setWorkingState(val);
}, []); }, []);
useEffect(() => {
if (!working || cutProgress == null) setDocumentExtraTitle();
else {
const parts = [];
if (working) parts.push(working);
if (cutProgress != null) parts.push(`${(cutProgress * 100).toFixed(1)}%`);
setDocumentExtraTitle(parts.join(' '));
}
}, [cutProgress, working]);
const zoom = Math.floor(zoomUnrounded); const zoom = Math.floor(zoomUnrounded);
const durationSafe = isDurationValid(duration) ? duration : 1; const durationSafe = isDurationValid(duration) ? duration : 1;