mirror of
https://github.com/HMCL-dev/HMCL.git
synced 2024-11-27 06:10:08 +08:00
chore: remove Mod download page link in version page.
This commit is contained in:
parent
e821f7cb09
commit
9fdf4f16c6
@ -27,14 +27,8 @@ import javafx.scene.control.Control;
|
||||
import javafx.scene.control.SkinBase;
|
||||
import javafx.scene.layout.BorderPane;
|
||||
import javafx.scene.layout.StackPane;
|
||||
import org.jackhuang.hmcl.mod.DownloadManager;
|
||||
import org.jackhuang.hmcl.mod.curse.CurseModManager;
|
||||
import org.jackhuang.hmcl.setting.Profile;
|
||||
import org.jackhuang.hmcl.setting.Theme;
|
||||
import org.jackhuang.hmcl.task.FileDownloadTask;
|
||||
import org.jackhuang.hmcl.task.Task;
|
||||
import org.jackhuang.hmcl.task.TaskExecutor;
|
||||
import org.jackhuang.hmcl.ui.Controllers;
|
||||
import org.jackhuang.hmcl.ui.FXUtils;
|
||||
import org.jackhuang.hmcl.ui.SVG;
|
||||
import org.jackhuang.hmcl.ui.animation.ContainerAnimations;
|
||||
@ -42,22 +36,18 @@ import org.jackhuang.hmcl.ui.animation.TransitionPane;
|
||||
import org.jackhuang.hmcl.ui.construct.*;
|
||||
import org.jackhuang.hmcl.ui.decorator.DecoratorPage;
|
||||
import org.jackhuang.hmcl.util.io.FileUtils;
|
||||
import org.jackhuang.hmcl.util.io.NetworkUtils;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Path;
|
||||
import java.util.Optional;
|
||||
|
||||
import static org.jackhuang.hmcl.util.i18n.I18n.i18n;
|
||||
|
||||
public class VersionPage extends Control implements DecoratorPage, DownloadPage.DownloadCallback {
|
||||
public class VersionPage extends Control implements DecoratorPage {
|
||||
private final ReadOnlyObjectWrapper<State> state = new ReadOnlyObjectWrapper<>();
|
||||
private final BooleanProperty loading = new SimpleBooleanProperty();
|
||||
private final TabHeader tab;
|
||||
private final TabHeader.Tab<VersionSettingsPage> versionSettingsTab = new TabHeader.Tab<>("versionSettingsTab");
|
||||
private final TabHeader.Tab<ModListPage> modListTab = new TabHeader.Tab<>("modListTab");
|
||||
private final TabHeader.Tab<DownloadListPage> curseModListTab = new TabHeader.Tab<>("modListTab");
|
||||
private final TabHeader.Tab<InstallerListPage> installerListTab = new TabHeader.Tab<>("installerListTab");
|
||||
private final TabHeader.Tab<WorldListPage> worldListTab = new TabHeader.Tab<>("worldList");
|
||||
private final TransitionPane transitionPane = new TransitionPane();
|
||||
@ -69,11 +59,10 @@ public class VersionPage extends Control implements DecoratorPage, DownloadPage.
|
||||
{
|
||||
versionSettingsTab.setNodeSupplier(VersionSettingsPage::new);
|
||||
modListTab.setNodeSupplier(ModListPage::new);
|
||||
curseModListTab.setNodeSupplier(() -> new DownloadListPage(CurseModManager.SECTION_MOD, this));
|
||||
installerListTab.setNodeSupplier(InstallerListPage::new);
|
||||
worldListTab.setNodeSupplier(WorldListPage::new);
|
||||
|
||||
tab = new TabHeader(versionSettingsTab, modListTab, curseModListTab, installerListTab, worldListTab);
|
||||
tab = new TabHeader(versionSettingsTab, modListTab, installerListTab, worldListTab);
|
||||
|
||||
addEventHandler(Navigator.NavigationEvent.NAVIGATED, this::onNavigated);
|
||||
|
||||
@ -111,8 +100,6 @@ public class VersionPage extends Control implements DecoratorPage, DownloadPage.
|
||||
versionSettingsTab.getNode().loadVersion(profile, version);
|
||||
if (modListTab.isInitialized())
|
||||
modListTab.getNode().loadVersion(profile, version);
|
||||
if (curseModListTab.isInitialized())
|
||||
curseModListTab.getNode().loadVersion(profile, version);
|
||||
if (installerListTab.isInitialized())
|
||||
installerListTab.getNode().loadVersion(profile, version);
|
||||
if (worldListTab.isInitialized())
|
||||
@ -198,28 +185,6 @@ public class VersionPage extends Control implements DecoratorPage, DownloadPage.
|
||||
return state.getReadOnlyProperty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void download(Profile profile, @Nullable String version, DownloadManager.Version file) {
|
||||
if (version == null) {
|
||||
throw new InternalError();
|
||||
}
|
||||
|
||||
Path dest = profile.getRepository().getRunDirectory(version).toPath().resolve("mods").resolve(file.getFile().getFilename());
|
||||
|
||||
TaskExecutorDialogPane downloadingPane = new TaskExecutorDialogPane(it -> {
|
||||
});
|
||||
|
||||
TaskExecutor executor = Task.composeAsync(() -> {
|
||||
FileDownloadTask task = new FileDownloadTask(NetworkUtils.toURL(file.getFile().getUrl()), dest.toFile());
|
||||
task.setName(file.getName());
|
||||
return task;
|
||||
}).executor(false);
|
||||
|
||||
downloadingPane.setExecutor(executor, true);
|
||||
Controllers.dialog(downloadingPane);
|
||||
executor.start();
|
||||
}
|
||||
|
||||
public static class Skin extends SkinBase<VersionPage> {
|
||||
|
||||
/**
|
||||
@ -257,14 +222,6 @@ public class VersionPage extends Control implements DecoratorPage, DownloadPage.
|
||||
modListItem.activeProperty().bind(control.tab.getSelectionModel().selectedItemProperty().isEqualTo(control.modListTab));
|
||||
modListItem.setOnAction(e -> control.tab.getSelectionModel().select(control.modListTab));
|
||||
|
||||
AdvancedListItem curseModListItem = new AdvancedListItem();
|
||||
curseModListItem.getStyleClass().add("navigation-drawer-item");
|
||||
curseModListItem.setTitle(i18n("mods.download"));
|
||||
curseModListItem.setLeftGraphic(wrap(SVG.fire(Theme.blackFillBinding(), 24, 24)));
|
||||
curseModListItem.setActionButtonVisible(false);
|
||||
curseModListItem.activeProperty().bind(control.tab.getSelectionModel().selectedItemProperty().isEqualTo(control.curseModListTab));
|
||||
curseModListItem.setOnAction(e -> control.tab.getSelectionModel().select(control.curseModListTab));
|
||||
|
||||
AdvancedListItem installerListItem = new AdvancedListItem();
|
||||
installerListItem.getStyleClass().add("navigation-drawer-item");
|
||||
installerListItem.setTitle(i18n("settings.tabs.installers"));
|
||||
@ -284,7 +241,6 @@ public class VersionPage extends Control implements DecoratorPage, DownloadPage.
|
||||
AdvancedListBox sideBar = new AdvancedListBox()
|
||||
.add(versionSettingsItem)
|
||||
.add(modListItem)
|
||||
.add(curseModListItem)
|
||||
.add(installerListItem)
|
||||
.add(worldListItem);
|
||||
left.setCenter(sideBar);
|
||||
|
Loading…
Reference in New Issue
Block a user