-
Notifications
You must be signed in to change notification settings - Fork 861
取消了下载界面硬控用户的功能,添加了下载界面的下载列表的bug(doge #5952
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
HMCL/src/main/java/org/jackhuang/hmcl/ui/download/DifferentDownloadTask2OneTask.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| /* | ||
| * Hello Minecraft! Launcher | ||
| * Copyright (C) 2026 huangyuhui <huanghongxun2008@126.com> and contributors | ||
| * | ||
| * This program is free software: you can redistribute it and/or modify | ||
| * it under the terms of the GNU General Public License as published by | ||
| * the Free Software Foundation, either version 3 of the License, or | ||
| * (at your option) any later version. | ||
| * | ||
| * This program is distributed in the hope that it will be useful, | ||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| * GNU General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU General Public License | ||
| * along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
| */ | ||
| package org.jackhuang.hmcl.ui.download; | ||
|
|
||
| import org.jackhuang.hmcl.task.Task; | ||
| import org.jackhuang.hmcl.task.TaskExecutor; | ||
| import org.jackhuang.hmcl.ui.versions.DownloadTaskList; | ||
|
|
||
| public class DifferentDownloadTask2OneTask{ | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 这个类和里面的方法都是什么见鬼的命名?为什么还在 |
||
|
|
||
| private static DownloadTaskList activeDownloadTaskList; | ||
|
|
||
| public static void setActiveDownloadTaskList(DownloadTaskList list) { | ||
| activeDownloadTaskList = list; | ||
| } | ||
|
|
||
| public void WizardTask2OneTask(Task<?> task) { | ||
| TaskExecutor executor = task.executor(); | ||
| if (activeDownloadTaskList != null) { | ||
| activeDownloadTaskList.addDownloadEntry(executor, task.getName()); | ||
| System.out.println("gotolist"); | ||
| } | ||
| } | ||
|
|
||
| public void ExecutorTask2OneTask(TaskExecutor executor, String name) { | ||
| if (activeDownloadTaskList != null) { | ||
| activeDownloadTaskList.addDownloadEntry(executor, name); | ||
| System.out.println("gotolist"); | ||
| } | ||
| } | ||
|
|
||
| } | ||
72 changes: 72 additions & 0 deletions
72
HMCL/src/main/java/org/jackhuang/hmcl/ui/download/DownloadEntry.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| /* | ||
| * Hello Minecraft! Launcher | ||
| * Copyright (C) 2026 huangyuhui <huanghongxun2008@126.com> and contributors | ||
| * | ||
| * This program is free software: you can redistribute it and/or modify | ||
| * it under the terms of the GNU General Public License as published by | ||
| * the Free Software Foundation, either version 3 of the License, or | ||
| * (at your option) any later version. | ||
| * | ||
| * This program is distributed in the hope that it will be useful, | ||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| * GNU General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU General Public License | ||
| * along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
| */ | ||
| package org.jackhuang.hmcl.ui.download; | ||
|
|
||
| import javafx.beans.binding.Bindings; | ||
| import javafx.beans.binding.StringBinding; | ||
| import javafx.beans.property.DoubleProperty; | ||
| import javafx.beans.property.SimpleDoubleProperty; | ||
| import javafx.beans.property.SimpleStringProperty; | ||
| import javafx.beans.property.StringProperty; | ||
| import org.jackhuang.hmcl.task.TaskExecutor; | ||
|
|
||
| import static org.jackhuang.hmcl.util.i18n.I18n.i18n; | ||
|
|
||
| public class DownloadEntry { | ||
| private final short ProgressIsUncertain = -1; | ||
|
|
||
| public static final String STATUS_WAITING = "waiting"; | ||
| public static final String STATUS_RUNNING = "running"; | ||
| public static final String STATUS_DONE = "done"; | ||
| public static final String STATUS_FAILED = "failed"; | ||
|
|
||
| private final StringProperty name = new SimpleStringProperty(); | ||
| private final StringProperty status = new SimpleStringProperty(); | ||
| private final DoubleProperty progress = new SimpleDoubleProperty(ProgressIsUncertain); | ||
| private final TaskExecutor executor; | ||
|
|
||
|
|
||
| public DownloadEntry(TaskExecutor executor, String name) { | ||
| this.executor = executor; | ||
| this.name.set(name); | ||
| this.status.set(STATUS_WAITING); | ||
| } | ||
|
|
||
|
|
||
| public String getName() { return name.get(); } | ||
| public StringProperty nameProperty() { return name; } | ||
|
|
||
| public String getStatus() { return status.get(); } | ||
| public StringProperty statusProperty() { return status; } | ||
|
|
||
| public StringBinding statusI18NBinding() { | ||
| return Bindings.createStringBinding(() -> { | ||
| String s = status.get(); | ||
| if (STATUS_DONE.equals(s)) return i18n("download.task.status.done"); | ||
| if (STATUS_FAILED.equals(s)) return i18n("download.task.status.failed"); | ||
| if (STATUS_RUNNING.equals(s)) return i18n("download.task.status.running"); | ||
| if (STATUS_WAITING.equals(s)) return i18n("download.task.status.waiting"); | ||
| return i18n("download.task.status.null"); | ||
| }, status); | ||
| } | ||
|
|
||
| public double getProgress() { return progress.get(); } | ||
| public DoubleProperty progressProperty() { return progress; } | ||
|
|
||
| public TaskExecutor getExecutor() { return executor; } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -31,6 +31,7 @@ | |
| import org.jackhuang.hmcl.task.FileDownloadTask; | ||
| import org.jackhuang.hmcl.task.Schedulers; | ||
| 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; | ||
|
|
@@ -42,10 +43,7 @@ | |
| import org.jackhuang.hmcl.ui.construct.Validator; | ||
| import org.jackhuang.hmcl.ui.decorator.DecoratorAnimatedPage; | ||
| import org.jackhuang.hmcl.ui.decorator.DecoratorPage; | ||
| import org.jackhuang.hmcl.ui.versions.DownloadListPage; | ||
| import org.jackhuang.hmcl.ui.versions.HMCLLocalizedDownloadListPage; | ||
| import org.jackhuang.hmcl.ui.versions.VersionPage; | ||
| import org.jackhuang.hmcl.ui.versions.Versions; | ||
| import org.jackhuang.hmcl.ui.versions.*; | ||
| import org.jackhuang.hmcl.ui.wizard.Navigation; | ||
| import org.jackhuang.hmcl.ui.wizard.WizardController; | ||
| import org.jackhuang.hmcl.ui.wizard.WizardProvider; | ||
|
|
@@ -76,8 +74,10 @@ public class DownloadPage extends DecoratorAnimatedPage implements DecoratorPage | |
| private final TabHeader.Tab<DownloadListPage> resourcePackTab = new TabHeader.Tab<>("resourcePackTab"); | ||
| private final TabHeader.Tab<DownloadListPage> shaderTab = new TabHeader.Tab<>("shaderTab"); | ||
| private final TabHeader.Tab<DownloadListPage> worldTab = new TabHeader.Tab<>("worldTab"); | ||
| private final TabHeader.Tab<DownloadListPage> downloadListTab = new TabHeader.Tab<>("downloadListTab"); | ||
| private final TransitionPane transitionPane = new TransitionPane(); | ||
| private final DownloadNavigator versionPageNavigator = new DownloadNavigator(); | ||
| private final DownloadTaskList downloadTaskList; | ||
|
|
||
| private WeakListenerHolder listenerHolder; | ||
|
|
||
|
|
@@ -86,6 +86,9 @@ public DownloadPage() { | |
| } | ||
|
|
||
| public DownloadPage(String uploadVersion) { | ||
| this.downloadTaskList = new DownloadTaskList(); | ||
| DifferentDownloadTask2OneTask.setActiveDownloadTaskList(downloadTaskList); | ||
|
|
||
| newGameTab.setNodeSupplier(loadVersionFor(() -> new VersionsPage(versionPageNavigator, i18n("install.installer.choose", i18n("install.installer.game")), "", DownloadProviders.getDownloadProvider(), | ||
| "game", versionPageNavigator::onGameSelected))); | ||
| modpackTab.setNodeSupplier(loadVersionFor(() -> { | ||
|
|
@@ -99,31 +102,52 @@ public DownloadPage(String uploadVersion) { | |
| page.getActions().add(installLocalModpackButton); | ||
| return page; | ||
| })); | ||
|
|
||
| //下面是设置搜索界面的 | ||
| modTab.setNodeSupplier(loadVersionFor(() -> HMCLLocalizedDownloadListPage.ofMod((downloadProvider, profile, version, mod, file) -> download(downloadProvider, profile, version, file, "mods"), true))); | ||
| resourcePackTab.setNodeSupplier(loadVersionFor(() -> HMCLLocalizedDownloadListPage.ofResourcePack((downloadProvider, profile, version, mod, file) -> download(downloadProvider, profile, version, file, "resourcepacks"), true))); | ||
| shaderTab.setNodeSupplier(loadVersionFor(() -> HMCLLocalizedDownloadListPage.ofShaderPack((downloadProvider, profile, version, mod, file) -> download(downloadProvider, profile, version, file, "shaderpacks"), true))); | ||
| worldTab.setNodeSupplier(loadVersionFor(() -> new DownloadListPage(CurseForgeRemoteModRepository.WORLDS))); | ||
| tab = new TabHeader(transitionPane, newGameTab, modpackTab, modTab, resourcePackTab, shaderTab, worldTab); | ||
| downloadListTab.setNodeSupplier(() -> downloadTaskList); | ||
|
|
||
| Profiles.registerVersionsListener(this::loadVersions); | ||
|
|
||
| tab.select(newGameTab); | ||
|
|
||
| //这一堆规划了侧边栏的哪个按钮在哪个栏目 | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 建议不要用中文 |
||
| AdvancedListBox sideBar = new AdvancedListBox() | ||
| .startCategory(i18n("download.game").toUpperCase(Locale.ROOT)) | ||
| .addNavigationDrawerTab(tab, newGameTab, i18n("game"), SVG.STADIA_CONTROLLER, SVG.STADIA_CONTROLLER_FILL) | ||
| .addNavigationDrawerTab(tab, modpackTab, i18n("modpack"), SVG.PACKAGE2, SVG.PACKAGE2_FILL) | ||
|
|
||
| .startCategory(i18n("download.content").toUpperCase(Locale.ROOT)) | ||
| .addNavigationDrawerTab(tab, modTab, i18n("mods"), SVG.EXTENSION, SVG.EXTENSION_FILL) | ||
| .addNavigationDrawerTab(tab, resourcePackTab, i18n("resourcepack"), SVG.TEXTURE) | ||
| .addNavigationDrawerTab(tab, shaderTab, i18n("download.shader"), SVG.WB_SUNNY, SVG.WB_SUNNY_FILL) | ||
| .addNavigationDrawerTab(tab, worldTab, i18n("world"), SVG.PUBLIC); | ||
| .addNavigationDrawerTab(tab, worldTab, i18n("world"), SVG.PUBLIC) | ||
|
|
||
| .startCategory(i18n("download.others").toUpperCase(Locale.ROOT)) | ||
| .addNavigationDrawerTab(tab, downloadListTab, i18n("download.task"), SVG.DOWNLOAD); | ||
|
|
||
| FXUtils.setLimitWidth(sideBar, 200); | ||
| setLeft(sideBar); | ||
|
|
||
| setCenter(transitionPane); | ||
| } | ||
|
|
||
| public DownloadTaskList getDownloadTaskList() { | ||
| return downloadTaskList; | ||
| } | ||
|
|
||
| public void addDownloadTask(TaskExecutor executor, String name) { | ||
| downloadTaskList.addDownloadEntry(executor, name); | ||
| } | ||
|
|
||
| public void addDownloadTask(Task<?> task) { | ||
| addDownloadTask(task.executor(), task.getName()); | ||
| } | ||
|
|
||
| private static <T extends Node> Supplier<T> loadVersionFor(Supplier<T> nodeSupplier) { | ||
| return () -> { | ||
| T node = nodeSupplier.get(); | ||
|
|
||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这是在做什么?