diff --git a/electron/index.ts b/electron/index.ts index 4b88954..67f0ae4 100644 --- a/electron/index.ts +++ b/electron/index.ts @@ -1,10 +1,8 @@ import { getBatchArguments, - getBatchSharpenArguments, getDoubleUpscaleArguments, getDoubleUpscaleSecondPassArguments, getSingleImageArguments, - getSingleImageSharpenArguments, } from "./utils/getArguments"; // Native import { autoUpdater } from "electron-updater"; @@ -218,6 +216,14 @@ ipcMain.handle(commands.SELECT_FOLDER, async (event, message) => { } else { logit("Selected Folder Path: ", 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]; } }); diff --git a/renderer/atoms/userSettingsAtom.ts b/renderer/atoms/userSettingsAtom.ts index a33e698..fec7436 100644 --- a/renderer/atoms/userSettingsAtom.ts +++ b/renderer/atoms/userSettingsAtom.ts @@ -7,4 +7,6 @@ export const customModelsPathAtom = atomWithStorage( export const scaleAtom = atomWithStorage<"2" | "3" | "4">("scale", "4"); -export const batchModeAtom = atomWithStorage("batchMode", false); +export const batchModeAtom = atomWithStorage("batchMode", false); + +export const saveOutputFolderAtom = atomWithStorage("saveOutputFolder", false); diff --git a/renderer/components/Footer.tsx b/renderer/components/Footer.tsx index 8b473c8..3e131b1 100644 --- a/renderer/components/Footer.tsx +++ b/renderer/components/Footer.tsx @@ -8,27 +8,23 @@ function Footer() { + target="_blank"> Upscayl - {" "} - (v{navigator?.userAgent?.match(/Upscayl\/([\d\.]+\d+)/)[1]}) +

By{" "} + target="_blank"> TGS963 {" "} and{" "} + target="_blank"> Nayam Amarshe

diff --git a/renderer/components/SettingsTab.tsx b/renderer/components/SettingsTab.tsx index fe23ff8..1ecc1c7 100644 --- a/renderer/components/SettingsTab.tsx +++ b/renderer/components/SettingsTab.tsx @@ -1,13 +1,13 @@ import React, { useEffect, useState } from "react"; -import Select from "react-select"; -import ReactTooltip from "react-tooltip"; import { themeChange } from "theme-change"; -import log from "electron-log/renderer"; import commands from "../../electron/commands"; import { useAtom } from "jotai"; -import { customModelsPathAtom, scaleAtom } from "../atoms/userSettingsAtom"; -import { TModelsList, modelsListAtom } from "../atoms/modelsListAtom"; -import { atomWithStorage } from "jotai/utils"; +import { + customModelsPathAtom, + scaleAtom, + saveOutputFolderAtom, +} from "../atoms/userSettingsAtom"; +import { modelsListAtom } from "../atoms/modelsListAtom"; interface IProps { batchMode: boolean; @@ -42,9 +42,10 @@ function SettingsTab({ }); const [isCopied, setIsCopied] = useState(false); + const [customModelsPath, setCustomModelsPath] = useAtom(customModelsPathAtom); - const [customModelOptions, setCustomModelOptions] = useState([]); const [modelOptions, setModelOptions] = useAtom(modelsListAtom); + const [saveOutputFolder, setSaveOutputFolder] = useAtom(saveOutputFolderAtom); const [scale, setScale] = useAtom(scaleAtom); @@ -135,6 +136,65 @@ function SettingsTab({ return (
+ {/* THEME SELECTOR */} +
+

UPSCAYL THEME

+ +
+ +
+

SAVE OUTPUT FOLDER (PERMANENTLY)

+ { + setSaveOutputFolder((oldValue) => !oldValue); + }} + /> +
+ + {/* GPU ID INPUT */} +
+

GPU ID

+ +
+ + {/* GPU ID INPUT */} +
+

ADD CUSTOM MODELS

+

{customModelsPath}

+ +
+ {/* IMAGE FORMAT BUTTONS */}
@@ -178,53 +238,7 @@ function SettingsTab({
- {/* THEME SELECTOR */} -
-

UPSCAYL THEME

- -
- - {/* GPU ID INPUT */} -
-

GPU ID

- -
- - {/* GPU ID INPUT */} -
-

ADD CUSTOM MODELS

-

{customModelsPath}

- -
- + {/* IMAGE SCALE */}

IMAGE SCALE