@@ -130,7 +130,7 @@ public class DownloadPage extends DecoratorAnimatedPage implements DecoratorPage
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void download(Profile profile, @Nullable String version, RemoteMod.Version file, String subdirectoryName) {
|
public static void download(Profile profile, @Nullable String version, RemoteMod.Version file, String subdirectoryName) {
|
||||||
if (version == null) version = profile.getSelectedVersion();
|
if (version == null) version = profile.getSelectedVersion();
|
||||||
|
|
||||||
Path runDirectory = profile.getRepository().hasVersion(version) ? profile.getRepository().getRunDirectory(version).toPath() : profile.getRepository().getBaseDirectory().toPath();
|
Path runDirectory = profile.getRepository().hasVersion(version) ? profile.getRepository().getRunDirectory(version).toPath() : profile.getRepository().getBaseDirectory().toPath();
|
||||||
|
|||||||
@@ -479,7 +479,9 @@ public class DownloadPage extends Control implements DecoratorPage {
|
|||||||
|
|
||||||
this.setBody(box);
|
this.setBody(box);
|
||||||
|
|
||||||
JFXButton downloadButton = new JFXButton(type == RemoteModRepository.Type.MODPACK ? i18n("install.modpack") : i18n("mods.install"));
|
JFXButton downloadButton = null;
|
||||||
|
if (selfPage.callback != null) {
|
||||||
|
downloadButton = new JFXButton(type == RemoteModRepository.Type.MODPACK ? i18n("install.modpack") : i18n("mods.install"));
|
||||||
downloadButton.getStyleClass().add("dialog-accept");
|
downloadButton.getStyleClass().add("dialog-accept");
|
||||||
downloadButton.setOnAction(e -> {
|
downloadButton.setOnAction(e -> {
|
||||||
if (type == RemoteModRepository.Type.MODPACK || !spinnerPane.isLoading() && spinnerPane.getFailedReason() == null) {
|
if (type == RemoteModRepository.Type.MODPACK || !spinnerPane.isLoading() && spinnerPane.getFailedReason() == null) {
|
||||||
@@ -487,6 +489,7 @@ public class DownloadPage extends Control implements DecoratorPage {
|
|||||||
}
|
}
|
||||||
selfPage.download(version);
|
selfPage.download(version);
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
JFXButton saveAsButton = new JFXButton(i18n("mods.save_as"));
|
JFXButton saveAsButton = new JFXButton(i18n("mods.save_as"));
|
||||||
saveAsButton.getStyleClass().add("dialog-accept");
|
saveAsButton.getStyleClass().add("dialog-accept");
|
||||||
@@ -501,7 +504,11 @@ public class DownloadPage extends Control implements DecoratorPage {
|
|||||||
cancelButton.getStyleClass().add("dialog-cancel");
|
cancelButton.getStyleClass().add("dialog-cancel");
|
||||||
cancelButton.setOnAction(e -> fireEvent(new DialogCloseEvent()));
|
cancelButton.setOnAction(e -> fireEvent(new DialogCloseEvent()));
|
||||||
|
|
||||||
|
if (downloadButton == null) {
|
||||||
|
this.setActions(saveAsButton, cancelButton);
|
||||||
|
} else {
|
||||||
this.setActions(downloadButton, saveAsButton, cancelButton);
|
this.setActions(downloadButton, saveAsButton, cancelButton);
|
||||||
|
}
|
||||||
|
|
||||||
this.prefWidthProperty().bind(BindingMapping.of(Controllers.getStage().widthProperty()).map(w -> w.doubleValue() * 0.7));
|
this.prefWidthProperty().bind(BindingMapping.of(Controllers.getStage().widthProperty()).map(w -> w.doubleValue() * 0.7));
|
||||||
this.prefHeightProperty().bind(BindingMapping.of(Controllers.getStage().heightProperty()).map(w -> w.doubleValue() * 0.7));
|
this.prefHeightProperty().bind(BindingMapping.of(Controllers.getStage().heightProperty()).map(w -> w.doubleValue() * 0.7));
|
||||||
|
|||||||
@@ -446,7 +446,7 @@ class ModListPageSkin extends SkinBase<ModListPage> {
|
|||||||
repository instanceof CurseForgeRemoteModRepository ? HMCLLocalizedDownloadListPage.ofCurseForgeMod(null, false) : HMCLLocalizedDownloadListPage.ofModrinthMod(null, false),
|
repository instanceof CurseForgeRemoteModRepository ? HMCLLocalizedDownloadListPage.ofCurseForgeMod(null, false) : HMCLLocalizedDownloadListPage.ofModrinthMod(null, false),
|
||||||
remoteMod,
|
remoteMod,
|
||||||
new Profile.ProfileVersion(ModListPageSkin.this.getSkinnable().getProfile(), ModListPageSkin.this.getSkinnable().getVersionId()),
|
new Profile.ProfileVersion(ModListPageSkin.this.getSkinnable().getProfile(), ModListPageSkin.this.getSkinnable().getVersionId()),
|
||||||
null
|
(profile, version, file) -> org.jackhuang.hmcl.ui.download.DownloadPage.download(profile, version, file, "mods")
|
||||||
));
|
));
|
||||||
});
|
});
|
||||||
button.setDisable(false);
|
button.setDisable(false);
|
||||||
|
|||||||
Reference in New Issue
Block a user