Add: support for user-global configuration.

This commit is contained in:
iceBear67
2026-08-08 14:09:43 +08:00
parent 7c3262ee2e
commit 3afbdb2af2
24 changed files with 499 additions and 14 deletions
@@ -2,6 +2,7 @@ package dev.photosync.ui.screen;
import dev.photosync.core.config.AutoCaptureSettings;
import dev.photosync.core.config.BrowserSettings;
import dev.photosync.core.config.ConfigLocation;
import dev.photosync.core.config.NotificationSettings;
import dev.photosync.core.config.PhotoSyncConfig;
import dev.photosync.core.config.UploadSettings;
@@ -122,6 +123,7 @@ public final class SettingsScreen extends PhotoSyncScreen {
rows.clear();
measuredLineHeight = -1;
buildStorage();
buildConnection();
buildUpload();
buildAutoCapture();
@@ -129,6 +131,24 @@ public final class SettingsScreen extends PhotoSyncScreen {
buildBrowser();
}
private void buildStorage() {
heading("photosync.settings.section.storage");
Toggle outsideGame = new Toggle(chrome, chrome.translate("photosync.settings.user_config_location"),
() -> draft().location() == ConfigLocation.USER,
value -> edit(config -> config.toBuilder()
.location(value ? ConfigLocation.USER : ConfigLocation.INSTANCE)
.build()));
outsideGame.describedAs(chrome.translate("photosync.settings.user_config_location.detail",
ui.core().locations().directory(ConfigLocation.USER)));
rows.add(new Row("photosync.settings.user_config_location", content.add(outsideGame), true));
control("photosync.settings.config_folder",
new Button(chrome, chrome.translate("photosync.settings.show_folder"), this::revealConfigFolder));
}
private void revealConfigFolder() {
ui.game().reveal(ui.core().dataDirectory());
}
private void buildConnection() {
heading("photosync.settings.section.connection");