mirror of
https://github.com/HMCL-dev/HMCL.git
synced 2025-09-18 08:16:58 -04:00
add: clear button for cache directory
This commit is contained in:
parent
a1226012ff
commit
bc4b41e8cd
@ -40,9 +40,11 @@ import org.jackhuang.hmcl.upgrade.UpdateChecker;
|
||||
import org.jackhuang.hmcl.upgrade.UpdateHandler;
|
||||
import org.jackhuang.hmcl.util.Logging;
|
||||
import org.jackhuang.hmcl.util.i18n.Locales;
|
||||
import org.jackhuang.hmcl.util.io.FileUtils;
|
||||
import org.jackhuang.hmcl.util.javafx.SafeStringConverter;
|
||||
|
||||
import java.awt.*;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.Proxy;
|
||||
import java.nio.file.Files;
|
||||
@ -251,4 +253,9 @@ public final class SettingsPage extends SettingsView implements DecoratorPage {
|
||||
protected void onSponsor() {
|
||||
FXUtils.openLink("https://hmcl.huangyuhui.net/api/redirect/sponsor");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void clearCacheDirectory() {
|
||||
FileUtils.cleanDirectoryQuietly(new File(Settings.instance().getCommonDirectory(), "cache"));
|
||||
}
|
||||
}
|
||||
|
@ -183,6 +183,14 @@ public abstract class SettingsView extends StackPane {
|
||||
fileCommonLocation.setHasSubtitle(true);
|
||||
fileCommonLocation.setCustomText("settings.custom");
|
||||
|
||||
{
|
||||
JFXButton cleanButton = new JFXButton(i18n("launcher.cache_directory.clean"));
|
||||
cleanButton.setOnMouseClicked(e -> clearCacheDirectory());
|
||||
cleanButton.getStyleClass().add("jfx-button-border");
|
||||
|
||||
fileCommonLocation.setHeaderRight(cleanButton);
|
||||
}
|
||||
|
||||
settingsPane.getContent().add(fileCommonLocation);
|
||||
}
|
||||
|
||||
@ -526,4 +534,5 @@ public abstract class SettingsView extends StackPane {
|
||||
protected abstract void onHelp();
|
||||
protected abstract void onExportLogs();
|
||||
protected abstract void onSponsor();
|
||||
protected abstract void clearCacheDirectory();
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ import javafx.beans.property.SimpleObjectProperty;
|
||||
import javafx.scene.Node;
|
||||
|
||||
@DefaultProperty("content")
|
||||
public final class ComponentSublist extends ComponentList {
|
||||
public class ComponentSublist extends ComponentList {
|
||||
|
||||
private final ObjectProperty<Node> headerLeft = new SimpleObjectProperty<>(this, "headerLeft");
|
||||
private final ObjectProperty<Node> headerRight = new SimpleObjectProperty<>(this, "headerRight");
|
||||
|
@ -47,7 +47,7 @@ import java.util.function.Consumer;
|
||||
|
||||
import static org.jackhuang.hmcl.util.i18n.I18n.i18n;
|
||||
|
||||
public class MultiFileItem<T> extends ComponentList {
|
||||
public class MultiFileItem<T> extends ComponentSublist {
|
||||
private final StringProperty customTitle = new SimpleStringProperty(this, "customTitle", i18n("selector.custom"));
|
||||
private final StringProperty chooserTitle = new SimpleStringProperty(this, "chooserTitle", i18n("selector.choose_file"));
|
||||
private final BooleanProperty directory = new SimpleBooleanProperty(this, "directory", false);
|
||||
|
@ -193,6 +193,7 @@ launcher.background=Background Image
|
||||
launcher.background.choose=Choose a background image file
|
||||
launcher.background.default=Standard
|
||||
launcher.cache_directory=Directory for caching
|
||||
launcher.cache_directory.clean=Clear
|
||||
launcher.cache_directory.choose=Choose the directory for caching
|
||||
launcher.cache_directory.default=Standard
|
||||
launcher.cache_directory.disabled=Disabled
|
||||
|
@ -190,6 +190,7 @@ launcher.background=Изображение на заднем плане
|
||||
launcher.background.choose=Выберите путь до изображения на заднем плане
|
||||
launcher.background.default=Стандартное
|
||||
launcher.cache_directory=Каталог для скачки библиотек
|
||||
launcher.cache_directory.clean=Очистить
|
||||
launcher.cache_directory.choose=Выбор каталога для скачки кеша
|
||||
launcher.cache_directory.default=По умолчанию
|
||||
launcher.cache_directory.disabled=Отключено
|
||||
|
@ -191,6 +191,7 @@ launcher.background=背景位址
|
||||
launcher.background.choose=選擇背景路徑
|
||||
launcher.background.default=預設(自動尋找啟動器同目錄下的 background.png/jpg 及 bg 資料夾內的圖片)
|
||||
launcher.cache_directory=檔案下載快取目錄
|
||||
launcher.cache_directory.clean=清理
|
||||
launcher.cache_directory.choose=選擇檔案下載快取目錄
|
||||
launcher.cache_directory.default=預設
|
||||
launcher.cache_directory.disabled=停用
|
||||
|
@ -192,6 +192,7 @@ launcher.background=背景地址
|
||||
launcher.background.choose=选择背景路径
|
||||
launcher.background.default=默认(自动检索启动器同目录下的 background.png/jpg 及 bg 文件夹内的图片)
|
||||
launcher.cache_directory=文件下载缓存目录
|
||||
launcher.cache_directory.clean=清理
|
||||
launcher.cache_directory.choose=选择文件下载缓存目录
|
||||
launcher.cache_directory.default=默认(%AppData%/.minecraft 或者 ~/.minecraft)
|
||||
launcher.cache_directory.disabled=禁用(总是使用游戏路径)
|
||||
|
@ -48,7 +48,7 @@ public final class Schedulers {
|
||||
|
||||
public static synchronized ThreadPoolExecutor io() {
|
||||
if (IO_EXECUTOR == null)
|
||||
IO_EXECUTOR = new ThreadPoolExecutor(0, 6,
|
||||
IO_EXECUTOR = new ThreadPoolExecutor(6, 6,
|
||||
60L, TimeUnit.SECONDS,
|
||||
new SynchronousQueue<>(),
|
||||
runnable -> {
|
||||
|
Loading…
x
Reference in New Issue
Block a user