Skip to content
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

添加复制模组名称的按钮 #3242

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,13 @@ protected ModDownloadPageSkin(DownloadPage control) {
.collect(Collectors.toList()));
descriptionPane.getChildren().add(content);

JFXHyperlink copyNameButton = new JFXHyperlink(i18n("mods.name.copy"));
copyNameButton.setOnAction(e -> {
FXUtils.copyText(content.getTitle());
});
copyNameButton.setMinWidth(Region.USE_PREF_SIZE);
descriptionPane.getChildren().add(copyNameButton);

if (getSkinnable().mod != null) {
JFXHyperlink openMcmodButton = new JFXHyperlink(i18n("mods.mcmod"));
openMcmodButton.setExternalLink(getSkinnable().translations.getMcmodUrl(getSkinnable().mod));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,15 @@ class ModInfoDialog extends JFXDialogLayout {
getActions().add(mcmodButton);
}

if (StringUtils.isNotBlank(modInfo.getModInfo().getName())) {
JFXHyperlink copyNameButton = new JFXHyperlink(i18n("mods.name.copy"));
copyNameButton.setOnAction(e -> {
FXUtils.copyText(modInfo.getModInfo().getName());
});

getActions().add(copyNameButton);
}

JFXButton okButton = new JFXButton();
okButton.getStyleClass().add("dialog-accept");
okButton.setText(i18n("button.ok"));
Expand Down
1 change: 1 addition & 0 deletions HMCL/src/main/resources/assets/lang/I18N.properties
Original file line number Diff line number Diff line change
Expand Up @@ -996,6 +996,7 @@ mods.check_updates.source=Source
mods.check_updates.target_version=Target Version
mods.check_updates.update=Update
mods.choose_mod=Choose mod
mods.name.copy=Copy Name
mods.curseforge=CurseForge
mods.dependency.embedded=Built-in Dependencies (Already packaged in the mod file by the author. No need to download separately)
mods.dependency.optional=Optional Dependencies (If missing, the game will run normally, but the mod features may be missing)
Expand Down
1 change: 1 addition & 0 deletions HMCL/src/main/resources/assets/lang/I18N_zh.properties
Original file line number Diff line number Diff line change
Expand Up @@ -800,6 +800,7 @@ mods.check_updates.source=來源
mods.check_updates.target_version=目標版本
mods.check_updates.update=更新
mods.choose_mod=選取模組
mods.name.copy=複製名稱
mods.curseforge=CurseForge
mods.dependency.embedded=內建相依模組 (作者已經打包在模組檔中,無需單獨下載)
mods.dependency.optional=可選相依模組 (如果不安裝,遊戲可以執行,但模組功能可能缺失)
Expand Down
1 change: 1 addition & 0 deletions HMCL/src/main/resources/assets/lang/I18N_zh_CN.properties
Original file line number Diff line number Diff line change
Expand Up @@ -811,6 +811,7 @@ mods.check_updates.source=来源
mods.check_updates.target_version=目标版本
mods.check_updates.update=更新
mods.choose_mod=选择模组
mods.name.copy=复制名称
mods.curseforge=CurseForge
mods.dependency.embedded=内置的前置模组 (已经由作者打包在模组文件中,无需另外下载)
mods.dependency.optional=可选的前置模组 (若缺失游戏能够正常运行,但模组功能可能缺失)
Expand Down
Loading