From 5f8107de98acff4bc77d132b6c145e379f2c3354 Mon Sep 17 00:00:00 2001 From: Mikael Finstad Date: Fri, 27 Jan 2023 13:29:01 +0900 Subject: [PATCH] fix problem with title bar #1435 --- src/App.jsx | 16 +++++++--------- src/util.js | 7 +------ 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/src/App.jsx b/src/App.jsx index bff8898e..a712663d 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -61,7 +61,7 @@ import { shouldCopyStreamByDefault, getAudioStreams, getRealVideoStreams, isAudi import { exportEdlFile, readEdlFile, saveLlcProject, loadLlcProject, askForEdlImport } from './edlStore'; import { formatYouTube, getFrameCountRaw } from './edlFormats'; import { - getOutPath, getSuffixedOutPath, toast, errorToast, handleError, setFileNameTitle, getOutDir, getFileDir, + getOutPath, getSuffixedOutPath, toast, errorToast, handleError, getOutDir, getFileDir, checkDirWriteAccess, dirExists, isMasBuild, isStoreBuild, dragPreventer, filenamify, getOutFileExtension, generateSegFileName, defaultOutSegTemplate, havePermissionToReadFile, resolvePathIfNeeded, getPathReadAccessError, html5ifiedPrefix, html5dummySuffix, findExistingHtml5FriendlyFile, @@ -202,14 +202,14 @@ const App = memo(() => { }, []); useEffect(() => { - if (!working || cutProgress == null) setDocumentExtraTitle(); - else { - const parts = []; - if (working) parts.push(working); + const parts = []; + if (filePath) parts.push(basename(filePath)); + if (working) { + parts.push('-', working); if (cutProgress != null) parts.push(`${(cutProgress * 100).toFixed(1)}%`); - setDocumentExtraTitle(parts.join(' ')); } - }, [cutProgress, working]); + setDocumentExtraTitle(parts.length > 0 ? parts.join(' ') : undefined); + }, [cutProgress, filePath, working]); const zoom = Math.floor(zoomUnrounded); @@ -918,7 +918,6 @@ const App = memo(() => { video.playbackRate = 1; // setWorking(); - setFileNameTitle(); setPreviewFilePath(); setUsingDummyVideo(false); setPlaying(false); @@ -1645,7 +1644,6 @@ const App = memo(() => { setMainVideoStream(videoStream); setMainAudioStream(audioStream); setCopyStreamIdsForPath(fp, () => copyStreamIdsForPathNew); - setFileNameTitle(fp); setFileFormat(outFormatLocked || fileFormatNew); setDetectedFileFormat(fileFormatNew); diff --git a/src/util.js b/src/util.js index a8199c97..871d3e6b 100644 --- a/src/util.js +++ b/src/util.js @@ -6,7 +6,7 @@ import ky from 'ky'; import isDev from './isDev'; -const { dirname, parse: parsePath, join, basename, extname, isAbsolute, resolve } = window.require('path'); +const { dirname, parse: parsePath, join, extname, isAbsolute, resolve } = window.require('path'); const fs = window.require('fs-extra'); const os = window.require('os'); const { ipcRenderer } = window.require('electron'); @@ -135,11 +135,6 @@ export function handleError(arg1, arg2) { }); } -export function setFileNameTitle(filePath) { - const appName = 'LosslessCut'; - document.title = filePath ? `${appName} - ${basename(filePath)}` : appName; -} - export function filenamify(name) { return name.replace(/[^0-9a-zA-Z_\-.]/g, '_'); }