mirror of
https://github.com/upscayl/upscayl.git
synced 2025-01-19 01:24:09 +01:00
Reversed footer and added saveOutputfolder
This commit is contained in:
parent
eef52b14a6
commit
cb82bc061e
@ -1,10 +1,8 @@
|
|||||||
import {
|
import {
|
||||||
getBatchArguments,
|
getBatchArguments,
|
||||||
getBatchSharpenArguments,
|
|
||||||
getDoubleUpscaleArguments,
|
getDoubleUpscaleArguments,
|
||||||
getDoubleUpscaleSecondPassArguments,
|
getDoubleUpscaleSecondPassArguments,
|
||||||
getSingleImageArguments,
|
getSingleImageArguments,
|
||||||
getSingleImageSharpenArguments,
|
|
||||||
} from "./utils/getArguments";
|
} from "./utils/getArguments";
|
||||||
// Native
|
// Native
|
||||||
import { autoUpdater } from "electron-updater";
|
import { autoUpdater } from "electron-updater";
|
||||||
@ -218,6 +216,14 @@ ipcMain.handle(commands.SELECT_FOLDER, async (event, message) => {
|
|||||||
} else {
|
} else {
|
||||||
logit("Selected Folder Path: ", folderPaths[0]);
|
logit("Selected Folder Path: ", folderPaths[0]);
|
||||||
folderPath = folderPaths[0];
|
folderPath = folderPaths[0];
|
||||||
|
mainWindow.webContents
|
||||||
|
.executeJavaScript(
|
||||||
|
`localStorage.setItem("lastImagePath", "${folderPath}");`,
|
||||||
|
true
|
||||||
|
)
|
||||||
|
.then(() => {
|
||||||
|
logit(`Saved Last Image Path (${folderPath}) to Local Storage`);
|
||||||
|
});
|
||||||
return folderPaths[0];
|
return folderPaths[0];
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -7,4 +7,6 @@ export const customModelsPathAtom = atomWithStorage<string | null>(
|
|||||||
|
|
||||||
export const scaleAtom = atomWithStorage<"2" | "3" | "4">("scale", "4");
|
export const scaleAtom = atomWithStorage<"2" | "3" | "4">("scale", "4");
|
||||||
|
|
||||||
export const batchModeAtom = atomWithStorage<boolean>("batchMode", false);
|
export const batchModeAtom = atomWithStorage("batchMode", false);
|
||||||
|
|
||||||
|
export const saveOutputFolderAtom = atomWithStorage("saveOutputFolder", false);
|
||||||
|
@ -8,27 +8,23 @@ function Footer() {
|
|||||||
<a
|
<a
|
||||||
className="font-bold"
|
className="font-bold"
|
||||||
href="https://github.com/upscayl/upscayl"
|
href="https://github.com/upscayl/upscayl"
|
||||||
target="_blank"
|
target="_blank">
|
||||||
>
|
|
||||||
Upscayl
|
Upscayl
|
||||||
</a>{" "}
|
</a>
|
||||||
(v<span className="font-bold">{navigator?.userAgent?.match(/Upscayl\/([\d\.]+\d+)/)[1]}</span>)
|
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
By{" "}
|
By{" "}
|
||||||
<a
|
<a
|
||||||
href="https://github.com/TGS963"
|
href="https://github.com/TGS963"
|
||||||
className="font-bold"
|
className="font-bold"
|
||||||
target="_blank"
|
target="_blank">
|
||||||
>
|
|
||||||
TGS963
|
TGS963
|
||||||
</a>{" "}
|
</a>{" "}
|
||||||
and{" "}
|
and{" "}
|
||||||
<a
|
<a
|
||||||
href="https://github.com/NayamAmarshe"
|
href="https://github.com/NayamAmarshe"
|
||||||
className="font-bold"
|
className="font-bold"
|
||||||
target="_blank"
|
target="_blank">
|
||||||
>
|
|
||||||
Nayam Amarshe
|
Nayam Amarshe
|
||||||
</a>
|
</a>
|
||||||
</p>
|
</p>
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
import React, { useEffect, useState } from "react";
|
import React, { useEffect, useState } from "react";
|
||||||
import Select from "react-select";
|
|
||||||
import ReactTooltip from "react-tooltip";
|
|
||||||
import { themeChange } from "theme-change";
|
import { themeChange } from "theme-change";
|
||||||
import log from "electron-log/renderer";
|
|
||||||
import commands from "../../electron/commands";
|
import commands from "../../electron/commands";
|
||||||
import { useAtom } from "jotai";
|
import { useAtom } from "jotai";
|
||||||
import { customModelsPathAtom, scaleAtom } from "../atoms/userSettingsAtom";
|
import {
|
||||||
import { TModelsList, modelsListAtom } from "../atoms/modelsListAtom";
|
customModelsPathAtom,
|
||||||
import { atomWithStorage } from "jotai/utils";
|
scaleAtom,
|
||||||
|
saveOutputFolderAtom,
|
||||||
|
} from "../atoms/userSettingsAtom";
|
||||||
|
import { modelsListAtom } from "../atoms/modelsListAtom";
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
batchMode: boolean;
|
batchMode: boolean;
|
||||||
@ -42,9 +42,10 @@ function SettingsTab({
|
|||||||
});
|
});
|
||||||
|
|
||||||
const [isCopied, setIsCopied] = useState(false);
|
const [isCopied, setIsCopied] = useState(false);
|
||||||
|
|
||||||
const [customModelsPath, setCustomModelsPath] = useAtom(customModelsPathAtom);
|
const [customModelsPath, setCustomModelsPath] = useAtom(customModelsPathAtom);
|
||||||
const [customModelOptions, setCustomModelOptions] = useState<TModelsList>([]);
|
|
||||||
const [modelOptions, setModelOptions] = useAtom(modelsListAtom);
|
const [modelOptions, setModelOptions] = useAtom(modelsListAtom);
|
||||||
|
const [saveOutputFolder, setSaveOutputFolder] = useAtom(saveOutputFolderAtom);
|
||||||
|
|
||||||
const [scale, setScale] = useAtom(scaleAtom);
|
const [scale, setScale] = useAtom(scaleAtom);
|
||||||
|
|
||||||
@ -135,6 +136,65 @@ function SettingsTab({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="animate-step-in animate flex h-screen flex-col gap-7 overflow-y-auto p-5 overflow-x-hidden">
|
<div className="animate-step-in animate flex h-screen flex-col gap-7 overflow-y-auto p-5 overflow-x-hidden">
|
||||||
|
{/* THEME SELECTOR */}
|
||||||
|
<div className="flex flex-col gap-2">
|
||||||
|
<p className="text-sm font-medium">UPSCAYL THEME</p>
|
||||||
|
<select data-choose-theme className="select-primary select">
|
||||||
|
<option value="dark">Default</option>
|
||||||
|
{availableThemes.map((theme) => {
|
||||||
|
return (
|
||||||
|
<option value={theme.value} key={theme.value}>
|
||||||
|
{theme.label.toLocaleUpperCase()}
|
||||||
|
</option>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="flex flex-col gap-2">
|
||||||
|
<p className="text-sm font-medium">SAVE OUTPUT FOLDER (PERMANENTLY)</p>
|
||||||
|
<input
|
||||||
|
type="checkbox"
|
||||||
|
className="toggle-primary toggle"
|
||||||
|
defaultChecked={saveOutputFolder}
|
||||||
|
onClick={() => {
|
||||||
|
setSaveOutputFolder((oldValue) => !oldValue);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* GPU ID INPUT */}
|
||||||
|
<div className="flex flex-col gap-2">
|
||||||
|
<p className="text-sm font-medium">GPU ID</p>
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
placeholder="Type here"
|
||||||
|
className="input-bordered input w-full max-w-xs"
|
||||||
|
value={gpuId}
|
||||||
|
onChange={handleGpuIdChange}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* GPU ID INPUT */}
|
||||||
|
<div className="flex flex-col items-start gap-2">
|
||||||
|
<p className="text-sm font-medium">ADD CUSTOM MODELS</p>
|
||||||
|
<p className="text-sm text-base-content/60">{customModelsPath}</p>
|
||||||
|
<button
|
||||||
|
className="btn-primary btn"
|
||||||
|
onClick={async () => {
|
||||||
|
const customModelPath = await window.electron.invoke(
|
||||||
|
commands.SELECT_CUSTOM_MODEL_FOLDER
|
||||||
|
);
|
||||||
|
|
||||||
|
if (customModelPath !== null) {
|
||||||
|
setCustomModelsPath(customModelPath);
|
||||||
|
window.electron.send(commands.GET_MODELS_LIST, customModelPath);
|
||||||
|
}
|
||||||
|
}}>
|
||||||
|
Select Folder
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
{/* IMAGE FORMAT BUTTONS */}
|
{/* IMAGE FORMAT BUTTONS */}
|
||||||
<div className="flex flex-col gap-2">
|
<div className="flex flex-col gap-2">
|
||||||
<div className="flex flex-row gap-1">
|
<div className="flex flex-row gap-1">
|
||||||
@ -178,53 +238,7 @@ function SettingsTab({
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* THEME SELECTOR */}
|
{/* IMAGE SCALE */}
|
||||||
<div className="flex flex-col gap-2">
|
|
||||||
<p className="text-sm font-medium">UPSCAYL THEME</p>
|
|
||||||
<select data-choose-theme className="select-primary select">
|
|
||||||
<option value="dark">Default</option>
|
|
||||||
{availableThemes.map((theme) => {
|
|
||||||
return (
|
|
||||||
<option value={theme.value} key={theme.value}>
|
|
||||||
{theme.label.toLocaleUpperCase()}
|
|
||||||
</option>
|
|
||||||
);
|
|
||||||
})}
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{/* GPU ID INPUT */}
|
|
||||||
<div className="flex flex-col gap-2">
|
|
||||||
<p className="text-sm font-medium">GPU ID</p>
|
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
placeholder="Type here"
|
|
||||||
className="input-bordered input w-full max-w-xs"
|
|
||||||
value={gpuId}
|
|
||||||
onChange={handleGpuIdChange}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{/* GPU ID INPUT */}
|
|
||||||
<div className="flex flex-col items-start gap-2">
|
|
||||||
<p className="text-sm font-medium">ADD CUSTOM MODELS</p>
|
|
||||||
<p className="text-sm text-base-content/60">{customModelsPath}</p>
|
|
||||||
<button
|
|
||||||
className="btn-primary btn"
|
|
||||||
onClick={async () => {
|
|
||||||
const customModelPath = await window.electron.invoke(
|
|
||||||
commands.SELECT_CUSTOM_MODEL_FOLDER
|
|
||||||
);
|
|
||||||
|
|
||||||
if (customModelPath !== null) {
|
|
||||||
setCustomModelsPath(customModelPath);
|
|
||||||
window.electron.send(commands.GET_MODELS_LIST, customModelPath);
|
|
||||||
}
|
|
||||||
}}>
|
|
||||||
Select Folder
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<div className="flex flex-row gap-1">
|
<div className="flex flex-row gap-1">
|
||||||
<p className="text-sm font-medium">IMAGE SCALE</p>
|
<p className="text-sm font-medium">IMAGE SCALE</p>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user