Fix #4663: 排序模组时应忽略大小写 (#4665)

This commit is contained in:
Glavo
2025-10-13 15:13:46 +08:00
committed by GitHub
parent 58b357d4b8
commit 58d3780553
3 changed files with 4 additions and 12 deletions

View File

@@ -104,7 +104,7 @@ public final class ModListPage extends ListPageBase<ModListPageSkin.ModInfoObjec
lock.lock();
try {
modManager.refreshMods();
return modManager.getMods();
return modManager.getMods().stream().map(ModListPageSkin.ModInfoObject::new).toList();
} catch (IOException e) {
throw new UncheckedIOException(e);
} finally {
@@ -114,7 +114,7 @@ public final class ModListPage extends ListPageBase<ModListPageSkin.ModInfoObjec
updateSupportedLoaders(modManager);
if (exception == null) {
getItems().setAll(list.stream().map(ModListPageSkin.ModInfoObject::new).toList());
getItems().setAll(list);
} else {
LOG.warning("Failed to load mods", exception);
getItems().clear();

View File

@@ -18,7 +18,6 @@
package org.jackhuang.hmcl.ui.versions;
import com.jfoenix.controls.*;
import com.jfoenix.controls.datamodels.treetable.RecursiveTreeObject;
import javafx.animation.PauseTransition;
import javafx.beans.binding.Bindings;
import javafx.beans.property.BooleanProperty;
@@ -61,7 +60,6 @@ import org.jackhuang.hmcl.util.i18n.I18n;
import org.jackhuang.hmcl.util.io.CompressingUtils;
import org.jackhuang.hmcl.util.io.FileUtils;
import org.jackhuang.hmcl.util.io.NetworkUtils;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.lang.ref.SoftReference;
@@ -289,7 +287,7 @@ final class ModListPageSkin extends SkinBase<ModListPage> {
}
}
static final class ModInfoObject extends RecursiveTreeObject<ModInfoObject> implements Comparable<ModInfoObject> {
static final class ModInfoObject {
private final BooleanProperty active;
private final LocalModFile localModFile;
private final @Nullable ModTranslations.Mod modTranslations;
@@ -403,12 +401,6 @@ final class ModListPageSkin extends SkinBase<ModListPage> {
imageView.setImage(image);
}, Schedulers.javafx());
}
@Override
public int compareTo(@NotNull ModListPageSkin.ModInfoObject o) {
return localModFile.getFileName().toLowerCase(Locale.ROOT)
.compareTo(o.localModFile.getFileName().toLowerCase(Locale.ROOT));
}
}
final class ModInfoDialog extends JFXDialogLayout {

View File

@@ -189,7 +189,7 @@ public final class LocalModFile implements Comparable<LocalModFile> {
@Override
public int compareTo(LocalModFile o) {
return getFileName().compareTo(o.getFileName());
return getFileName().compareToIgnoreCase(o.getFileName());
}
@Override