show progress in title

closes #1417
pull/1255/head
Mikael Finstad 2023-01-09 12:39:14 +08:00
rodzic 91bf47eb5c
commit f1a9ea0e1d
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 25AB36E3E81CBC26
1 zmienionych plików z 15 dodań i 0 usunięć

Wyświetl plik

@ -97,6 +97,11 @@ const { focusWindow } = remote.require('./electron');
const calcShouldShowWaveform = (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 bottomMotionStyle = { background: controlsBackground };
@ -196,6 +201,16 @@ const App = memo(() => {
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 durationSafe = isDurationValid(duration) ? duration : 1;