1
0
mirror of https://github.com/upscayl/upscayl.git synced 2024-09-24 03:18:28 +02:00

Added new fonts

This commit is contained in:
Feenix 2022-11-25 12:24:30 +05:30
parent f9a2f0a027
commit 8593e3812b
9 changed files with 55 additions and 7 deletions

View File

@ -12,7 +12,9 @@ const commands = {
FOLDER_UPSCAYL_PROGRESS: FOLDER_UPSCAYL_PROGRESS:
"Send Folder Upscaling Progress from Main to Renderer", "Send Folder Upscaling Progress from Main to Renderer",
OPEN_FOLDER: "Open Folder", OPEN_FOLDER: "Open Folder",
SELECT_VIDEO: "Select a Video", UPSCAYL_VIDEO: "Upscale the Video",
UPSCAYL_VIDEO_DONE: "Video Upscaling Done",
UPSCAYL_VIDEO_PROGRESS: "Send Video Upscale Progress from Main to Renderer",
}; };
export default commands; export default commands;

BIN
renderer/Poppins-Black.ttf Normal file

Binary file not shown.

BIN
renderer/Poppins-Bold.ttf Normal file

Binary file not shown.

Binary file not shown.

BIN
renderer/Poppins-Medium.ttf Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -39,6 +39,9 @@ const Home = () => {
setBatchFolderPath(""); setBatchFolderPath("");
setUpscaledBatchFolderPath(""); setUpscaledBatchFolderPath("");
setVideoPath("");
setUpscaledVideoPath("");
}; };
useEffect(() => { useEffect(() => {
@ -92,6 +95,12 @@ const Home = () => {
} }
handleErrors(data); handleErrors(data);
}); });
window.electron.on(commands.UPSCAYL_VIDEO_PROGRESS, (_, data) => {
if (data.length > 0 && data.length < 10) {
setProgress(data);
}
handleErrors(data);
});
window.electron.on(commands.UPSCAYL_DONE, (_, data) => { window.electron.on(commands.UPSCAYL_DONE, (_, data) => {
setProgress(""); setProgress("");
@ -104,6 +113,9 @@ const Home = () => {
window.electron.on(commands.DOUBLE_UPSCAYL_DONE, (_, data) => { window.electron.on(commands.DOUBLE_UPSCAYL_DONE, (_, data) => {
setUpscaledImagePath(data); setUpscaledImagePath(data);
}); });
window.electron.on(commands.UPSCAYL_VIDEO_DONE, (_, data) => {
setUpscaledVideoPath(data);
});
}, []); }, []);
useEffect(() => { useEffect(() => {
@ -128,13 +140,22 @@ const Home = () => {
alert("Please select an image"); alert("Please select an image");
resetImagePaths(); resetImagePaths();
} }
} else if (videoPath.length > 0) {
const filePath = videoPath;
const extension = videoPath.toLocaleLowerCase().split(".").pop();
if (!allowedVideoFileTypes.includes(extension.toLowerCase())) {
alert("Please select an MP4, WebM or MKV video");
resetImagePaths();
}
} }
}, [imagePath]); }, [imagePath, videoPath]);
const selectVideoHandler = async () => { const selectVideoHandler = async () => {
resetImagePaths(); resetImagePaths();
var path = await window.electron.invoke(commands.SELECT_VIDEO); var path = await window.electron.invoke(commands.SELECT_FILE);
if (path !== "cancelled") { if (path !== "cancelled") {
setVideoPath(path); setVideoPath(path);
@ -190,6 +211,7 @@ const Home = () => {
}; };
const allowedFileTypes = ["png", "jpg", "jpeg", "webp"]; const allowedFileTypes = ["png", "jpg", "jpeg", "webp"];
const allowedVideoFileTypes = ["webm", "mp4", "mkv"];
const handleDrop = (e) => { const handleDrop = (e) => {
e.preventDefault(); e.preventDefault();
@ -203,12 +225,18 @@ const Home = () => {
console.log("🚀 => handleDrop => extension", extension); console.log("🚀 => handleDrop => extension", extension);
if ( if (
!type.includes("image") || (!type.includes("image") && !type.includes("video")) ||
!allowedFileTypes.includes(extension.toLowerCase()) (!allowedFileTypes.includes(extension.toLowerCase()) &&
!allowedVideoFileTypes.includes(extension.toLowerCase()))
) { ) {
alert("Please drag and drop an image"); alert("Please drag and drop an image");
} else { } else {
SetImagePath(filePath); if (isVideo) {
setVideoPath(filePath);
} else {
SetImagePath(filePath);
}
var dirname = filePath.match(/(.*)[\/\\]/)[1] || ""; var dirname = filePath.match(/(.*)[\/\\]/)[1] || "";
console.log("🚀 => handleDrop => dirname", dirname); console.log("🚀 => handleDrop => dirname", dirname);
setOutputPath(dirname); setOutputPath(dirname);
@ -245,7 +273,11 @@ const Home = () => {
}; };
const upscaylHandler = async () => { const upscaylHandler = async () => {
setUpscaledImagePath(""); if (isVideo) {
setUpscaledVideoPath("");
} else {
setUpscaledImagePath("");
}
if (imagePath !== "" || batchFolderPath !== "") { if (imagePath !== "" || batchFolderPath !== "") {
setProgress("Hold on..."); setProgress("Hold on...");
if (model === "models-DF2K") { if (model === "models-DF2K") {
@ -274,6 +306,13 @@ const Home = () => {
model, model,
}); });
} }
} else if (videoPath !== "") {
await window.electron.send(commands.UPSCAYL_VIDEO, {
scaleFactor,
imagePath,
outputPath,
model,
});
} else { } else {
alert("Please select an image to upscale"); alert("Please select an image to upscale");
} }

View File

@ -5,6 +5,13 @@
@layer base { @layer base {
* { * {
@apply select-none; @apply select-none;
font-family: "Poppins", sans-serif;
src: url("/Poppins-Regular.ttf") format("truetype"),
url("/Poppins-Medium.ttf") format("truetype"),
url("/Poppins-Semibold.ttf") format("truetype"),
url("/Poppins-Bold.ttf") format("truetype"),
url("/Poppins-ExtraBold.ttf") format("truetype"),
url("/Poppins-Black.ttf") format("truetype");
} }
::-webkit-scrollbar { ::-webkit-scrollbar {
@apply w-3; @apply w-3;