1
0
mirror of https://github.com/upscayl/upscayl.git synced 2025-01-18 17:14:08 +01:00

Updated stop button and warning

This commit is contained in:
Feenix 2023-04-29 22:42:40 +05:30
parent f39fac2be0
commit c7ec54fb5b
2 changed files with 17 additions and 8 deletions

View File

@ -14,7 +14,9 @@ function ProgressBar({ progress, doubleUpscaylCounter, stopHandler }) {
<p className="rounded-full bg-base-300 px-2 py-1 text-sm font-medium">
Doing the Upscayl magic...
</p>
<button onClick={stopHandler}>STOP</button>
<button onClick={stopHandler} className="btn-primary btn">
STOP
</button>
</div>
</div>
);

View File

@ -82,12 +82,12 @@ const Home = () => {
data.includes("encode")
? "ENCODING ERROR => "
: "DECODING ERROR => " +
"This image is possibly corrupt or not supported by Upscayl. You could try converting the image into another format and upscaling again. Otherwise, make sure that the output path is correct and you have the proper write permissions for the directory. If not, then unfortuantely this image is not supported by Upscayl, sorry."
"This image is possibly corrupt or not supported by Upscayl, or your GPU drivers are acting funny (Did you check if your GPU is compatible and drivers are alright?). You could try converting the image into another format and upscaling again. Also make sure that the output path is correct and you have the proper write permissions for the directory. If not, then unfortuantely there's not much we can do to help, sorry."
);
resetImagePaths();
} else if (data.includes("uncaughtException")) {
alert(
"Upscayl encountered an error. Possibly, the upscayl binary failed to execute the commands properly. Try launching Upscayl using commandline through Terminal and see if you get any information. You can post an issue on Upscayl's GitHub repository for more help."
"Upscayl encountered an error. Possibly, the upscayl binary failed to execute the commands properly. Try checking the logs to see if you get any information. You can post an issue on Upscayl's GitHub repository for more help."
);
resetImagePaths();
}
@ -142,7 +142,7 @@ const Home = () => {
if (progress === "") return;
setProgress("");
setUpscaledImagePath(data);
console.log("upscaledImagePath: ", upscaledImagePath)
console.log("upscaledImagePath: ", upscaledImagePath);
addToLog(data);
});
@ -479,12 +479,15 @@ const Home = () => {
const stopHandler = () => {
window.electron.send(commands.STOP);
resetImagePaths();
}
};
const formatPath = (path) => {
//USE REGEX TO GET THE FILENAME AND ENCODE IT INTO PROPER FORM IN ORDER TO AVOID ERRORS DUE TO SPECIAL CHARACTERS
return path.replace(/([^/\\]+)$/i, encodeURIComponent(path.match(/[^/\\]+$/i)[0]))
}
return path.replace(
/([^/\\]+)$/i,
encodeURIComponent(path.match(/[^/\\]+$/i)[0])
);
};
const allowedFileTypes = ["png", "jpg", "jpeg", "webp"];
const allowedVideoFileTypes = ["webm", "mp4", "mkv"];
@ -625,7 +628,11 @@ const Home = () => {
<img
src={
"file://" +
`${upscaledImagePath ? formatPath(upscaledImagePath) : formatPath(imagePath)}`
`${
upscaledImagePath
? formatPath(upscaledImagePath)
: formatPath(imagePath)
}`
}
onLoad={(e: any) => {
setDimensions({