From 501ecac4d5b4317d61bc7a6cff1c48821a04662a Mon Sep 17 00:00:00 2001 From: zkitefly Date: Fri, 23 Jun 2023 18:12:59 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=B8=80=E4=BA=9B=20tooltip?= =?UTF-8?q?=20(#2215)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 添加几个 FXUtils.installFastTooltip * add * add * add * 更新 VersionPage.java * add * add --- HMCL/src/main/java/org/jackhuang/hmcl/ui/GameCrashWindow.java | 3 +++ .../java/org/jackhuang/hmcl/ui/account/CreateAccountPane.java | 1 + .../java/org/jackhuang/hmcl/ui/main/LauncherSettingsPage.java | 2 ++ HMCL/src/main/java/org/jackhuang/hmcl/ui/main/MainPage.java | 2 ++ HMCL/src/main/java/org/jackhuang/hmcl/ui/main/RootPage.java | 1 + .../java/org/jackhuang/hmcl/ui/versions/DownloadPage.java | 4 ++++ .../java/org/jackhuang/hmcl/ui/versions/GameListItemSkin.java | 2 ++ .../java/org/jackhuang/hmcl/ui/versions/GameListPage.java | 3 +++ .../main/java/org/jackhuang/hmcl/ui/versions/VersionPage.java | 4 ++++ HMCL/src/main/resources/assets/lang/I18N.properties | 2 ++ HMCL/src/main/resources/assets/lang/I18N_es.properties | 2 ++ HMCL/src/main/resources/assets/lang/I18N_ja.properties | 2 ++ HMCL/src/main/resources/assets/lang/I18N_ru.properties | 2 ++ HMCL/src/main/resources/assets/lang/I18N_zh.properties | 2 ++ HMCL/src/main/resources/assets/lang/I18N_zh_CN.properties | 4 +++- 15 files changed, 35 insertions(+), 1 deletion(-) diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/GameCrashWindow.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/GameCrashWindow.java index 79811bb7e..991f073c0 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/GameCrashWindow.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/GameCrashWindow.java @@ -65,6 +65,7 @@ import java.util.regex.Pattern; import java.util.stream.Collectors; import static org.jackhuang.hmcl.setting.ConfigHolder.config; +import static org.jackhuang.hmcl.ui.FXUtils.runInFX; import static org.jackhuang.hmcl.ui.FXUtils.newImage; import static org.jackhuang.hmcl.util.Logging.LOG; import static org.jackhuang.hmcl.util.Pair.pair; @@ -347,11 +348,13 @@ public class GameCrashWindow extends Stage { gameDir.getStyleClass().setAll("two-line-item-second-large"); gameDir.setTitle(i18n("game.directory")); gameDir.setSubtitle(launchOptions.getGameDir().getAbsolutePath()); + runInFX(() -> FXUtils.installFastTooltip(gameDir, i18n("game.directory"))); TwoLineListItem javaDir = new TwoLineListItem(); javaDir.getStyleClass().setAll("two-line-item-second-large"); javaDir.setTitle(i18n("settings.game.java_directory")); javaDir.setSubtitle(launchOptions.getJava().getBinary().toAbsolutePath().toString()); + runInFX(() -> FXUtils.installFastTooltip(javaDir, i18n("settings.game.java_directory"))); Label reasonTitle = new Label(i18n("game.crash.reason")); reasonTitle.getStyleClass().add("two-line-item-second-large-title"); diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/account/CreateAccountPane.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/account/CreateAccountPane.java index 44cc2307b..cc1d87822 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/account/CreateAccountPane.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/account/CreateAccountPane.java @@ -528,6 +528,7 @@ public class CreateAccountPane extends JFXDialogLayout implements DialogAware { if (factory instanceof OfflineAccountFactory) { txtUsername.setPromptText(i18n("account.methods.offline.name.special_characters")); + runInFX(() -> FXUtils.installFastTooltip(txtUsername, i18n("account.methods.offline.name.special_characters"))); JFXHyperlink purchaseLink = new JFXHyperlink(i18n("account.methods.yggdrasil.purchase")); purchaseLink.setExternalLink(YggdrasilService.PURCHASE_URL); diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/main/LauncherSettingsPage.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/main/LauncherSettingsPage.java index d6c11595c..113b4c6d3 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/main/LauncherSettingsPage.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/main/LauncherSettingsPage.java @@ -33,6 +33,7 @@ import org.jackhuang.hmcl.ui.decorator.DecoratorPage; import org.jackhuang.hmcl.ui.versions.VersionSettingsPage; import static org.jackhuang.hmcl.ui.versions.VersionPage.wrap; +import static org.jackhuang.hmcl.ui.FXUtils.runInFX; import static org.jackhuang.hmcl.util.i18n.I18n.i18n; public class LauncherSettingsPage extends DecoratorAnimatedPage implements DecoratorPage, PageAware { @@ -72,6 +73,7 @@ public class LauncherSettingsPage extends DecoratorAnimatedPage implements Decor settingsItem.setTitle(i18n("settings.type.global.manage")); settingsItem.setLeftGraphic(wrap(SVG::gamepad)); settingsItem.activeProperty().bind(tab.getSelectionModel().selectedItemProperty().isEqualTo(gameTab)); + runInFX(() -> FXUtils.installFastTooltip(settingsItem, i18n("settings.type.global.manage"))); settingsItem.setOnAction(e -> tab.select(gameTab)); }) .startCategory(i18n("launcher")) diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/main/MainPage.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/main/MainPage.java index d619d6762..7278fc49c 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/main/MainPage.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/main/MainPage.java @@ -69,6 +69,7 @@ import java.util.stream.IntStream; import static org.jackhuang.hmcl.setting.ConfigHolder.config; import static org.jackhuang.hmcl.ui.FXUtils.SINE; +import static org.jackhuang.hmcl.ui.FXUtils.runInFX; import static org.jackhuang.hmcl.util.i18n.I18n.i18n; public final class MainPage extends StackPane implements DecoratorPage { @@ -227,6 +228,7 @@ public final class MainPage extends StackPane implements DecoratorPage { StackPane.setAlignment(svg, Pos.CENTER_RIGHT); graphic.getChildren().setAll(svg); graphic.setTranslateX(12); + runInFX(() -> FXUtils.installFastTooltip(menuButton, i18n("version.switch"))); menuButton.setGraphic(graphic); launchPane.getChildren().setAll(launchButton, separator, menuButton); diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/main/RootPage.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/main/RootPage.java index 65eb3fcf2..6298fb3ee 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/main/RootPage.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/main/RootPage.java @@ -150,6 +150,7 @@ public class RootPage extends DecoratorAnimatedPage implements DecoratorPage { downloadItem.setActionButtonVisible(false); downloadItem.setTitle(i18n("download")); downloadItem.setOnAction(e -> Controllers.navigate(Controllers.getDownloadPage())); + runInFX(() -> FXUtils.installFastTooltip(downloadItem, i18n("download.hint"))); // fifth item in left sidebar AdvancedListItem multiplayerItem = new AdvancedListItem(); diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/DownloadPage.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/DownloadPage.java index 1757ec5dc..1032a05be 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/DownloadPage.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/DownloadPage.java @@ -65,6 +65,7 @@ import java.util.stream.Collectors; import java.util.stream.Stream; import static org.jackhuang.hmcl.util.i18n.I18n.i18n; +import static org.jackhuang.hmcl.ui.FXUtils.runInFX; public class DownloadPage extends Control implements DecoratorPage { private final ReadOnlyObjectWrapper state = new ReadOnlyObjectWrapper<>(); @@ -262,17 +263,20 @@ public class DownloadPage extends Control implements DecoratorPage { JFXHyperlink openMcmodButton = new JFXHyperlink(i18n("mods.mcmod")); openMcmodButton.setExternalLink(getSkinnable().translations.getMcmodUrl(getSkinnable().mod)); descriptionPane.getChildren().add(openMcmodButton); + runInFX(() -> FXUtils.installFastTooltip(openMcmodButton, i18n("mods.mcmod"))); if (StringUtils.isNotBlank(getSkinnable().mod.getMcbbs())) { JFXHyperlink openMcbbsButton = new JFXHyperlink(i18n("mods.mcbbs")); openMcbbsButton.setExternalLink(ModManager.getMcbbsUrl(getSkinnable().mod.getMcbbs())); descriptionPane.getChildren().add(openMcbbsButton); + runInFX(() -> FXUtils.installFastTooltip(openMcbbsButton, i18n("mods.mcbbs"))); } } JFXHyperlink openUrlButton = new JFXHyperlink(control.page.getLocalizedOfficialPage()); openUrlButton.setExternalLink(getSkinnable().addon.getPageUrl()); descriptionPane.getChildren().add(openUrlButton); + runInFX(() -> FXUtils.installFastTooltip(openUrlButton, control.page.getLocalizedOfficialPage())); } { diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/GameListItemSkin.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/GameListItemSkin.java index 2e1e46b7a..99dba9f45 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/GameListItemSkin.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/GameListItemSkin.java @@ -92,6 +92,7 @@ public class GameListItemSkin extends SkinBase { btnLaunch.getStyleClass().add("toggle-icon4"); BorderPane.setAlignment(btnLaunch, Pos.CENTER); btnLaunch.setGraphic(FXUtils.limitingSize(SVG.rocketLaunchOutline(Theme.blackFillBinding(), 24, 24), 24, 24)); + runInFX(() -> FXUtils.installFastTooltip(btnLaunch, i18n("version.launch.test"))); right.getChildren().add(btnLaunch); } @@ -104,6 +105,7 @@ public class GameListItemSkin extends SkinBase { btnManage.getStyleClass().add("toggle-icon4"); BorderPane.setAlignment(btnManage, Pos.CENTER); btnManage.setGraphic(FXUtils.limitingSize(SVG.dotsVertical(Theme.blackFillBinding(), 24, 24), 24, 24)); + runInFX(() -> FXUtils.installFastTooltip(btnManage, i18n("settings.game.management"))); right.getChildren().add(btnManage); } diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/GameListPage.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/GameListPage.java index 83c19f2a8..57d89504c 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/GameListPage.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/GameListPage.java @@ -91,11 +91,13 @@ public class GameListPage extends DecoratorAnimatedPage implements DecoratorPage installNewGameItem.setTitle(i18n("install.new_game")); installNewGameItem.setLeftGraphic(VersionPage.wrap(SVG::plusCircleOutline)); installNewGameItem.setOnAction(e -> Versions.addNewGame()); + runInFX(() -> FXUtils.installFastTooltip(installNewGameItem, i18n("install.new_game"))); }) .addNavigationDrawerItem(installModpackItem -> { installModpackItem.setTitle(i18n("install.modpack")); installModpackItem.setLeftGraphic(VersionPage.wrap(SVG::pack)); installModpackItem.setOnAction(e -> Versions.importModpack()); + runInFX(() -> FXUtils.installFastTooltip(installModpackItem, i18n("install.modpack"))); }) .addNavigationDrawerItem(refreshItem -> { refreshItem.setTitle(i18n("button.refresh")); @@ -106,6 +108,7 @@ public class GameListPage extends DecoratorAnimatedPage implements DecoratorPage globalManageItem.setTitle(i18n("settings.type.global.manage")); globalManageItem.setLeftGraphic(VersionPage.wrap(SVG::gearOutline)); globalManageItem.setOnAction(e -> modifyGlobalGameSettings()); + runInFX(() -> FXUtils.installFastTooltip(globalManageItem, i18n("settings.type.global.manage"))); }); FXUtils.setLimitHeight(bottomLeftCornerList, 40 * 4 + 12 * 2); setLeft(pane, bottomLeftCornerList); diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/VersionPage.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/VersionPage.java index fb68d8896..ec6bee90f 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/VersionPage.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/VersionPage.java @@ -239,6 +239,7 @@ public class VersionPage extends DecoratorAnimatedPage implements DecoratorPage versionSettingsItem.setLeftGraphic(wrap(SVG::gearOutline)); versionSettingsItem.setActionButtonVisible(false); versionSettingsItem.activeProperty().bind(control.tab.getSelectionModel().selectedItemProperty().isEqualTo(control.versionSettingsTab)); + runInFX(() -> FXUtils.installFastTooltip(versionSettingsItem, i18n("settings.game"))); versionSettingsItem.setOnAction(e -> control.tab.select(control.versionSettingsTab)); AdvancedListItem modListItem = new AdvancedListItem(); @@ -247,6 +248,7 @@ public class VersionPage extends DecoratorAnimatedPage implements DecoratorPage modListItem.setLeftGraphic(wrap(SVG::puzzle)); modListItem.setActionButtonVisible(false); modListItem.activeProperty().bind(control.tab.getSelectionModel().selectedItemProperty().isEqualTo(control.modListTab)); + runInFX(() -> FXUtils.installFastTooltip(modListItem, i18n("mods.manage"))); modListItem.setOnAction(e -> control.tab.select(control.modListTab)); AdvancedListItem installerListItem = new AdvancedListItem(); @@ -255,6 +257,7 @@ public class VersionPage extends DecoratorAnimatedPage implements DecoratorPage installerListItem.setLeftGraphic(wrap(SVG::cube)); installerListItem.setActionButtonVisible(false); installerListItem.activeProperty().bind(control.tab.getSelectionModel().selectedItemProperty().isEqualTo(control.installerListTab)); + runInFX(() -> FXUtils.installFastTooltip(installerListItem, i18n("settings.tabs.installers"))); installerListItem.setOnAction(e -> control.tab.select(control.installerListTab)); AdvancedListItem worldListItem = new AdvancedListItem(); @@ -263,6 +266,7 @@ public class VersionPage extends DecoratorAnimatedPage implements DecoratorPage worldListItem.setLeftGraphic(wrap(SVG::earth)); worldListItem.setActionButtonVisible(false); worldListItem.activeProperty().bind(control.tab.getSelectionModel().selectedItemProperty().isEqualTo(control.worldListTab)); + runInFX(() -> FXUtils.installFastTooltip(worldListItem, i18n("world.manage"))); worldListItem.setOnAction(e -> control.tab.select(control.worldListTab)); AdvancedListBox sideBar = new AdvancedListBox() diff --git a/HMCL/src/main/resources/assets/lang/I18N.properties b/HMCL/src/main/resources/assets/lang/I18N.properties index e7578754e..0d04f69db 100644 --- a/HMCL/src/main/resources/assets/lang/I18N.properties +++ b/HMCL/src/main/resources/assets/lang/I18N.properties @@ -306,6 +306,7 @@ curse.sort.popularity=Popularity curse.sort.total_downloads=Total Downloads download=Download +download.hint=Install games and modpacks or download mods, resource packs and maps download.code.404=File not found on the remote server: %s download.content=Addons download.curseforge.customization=Light and shadow, and game customization @@ -1156,6 +1157,7 @@ version.game.snapshot=Snapshot version.game.snapshots=Snapshots version.launch=Launch Game version.launch.test=Test Launch +version.switch=Switch version version.launch_script=Export Launch Script version.launch_script.failed=Unable to export launch script. version.launch_script.save=Export Launch Script diff --git a/HMCL/src/main/resources/assets/lang/I18N_es.properties b/HMCL/src/main/resources/assets/lang/I18N_es.properties index 46d30dd51..5854cca50 100644 --- a/HMCL/src/main/resources/assets/lang/I18N_es.properties +++ b/HMCL/src/main/resources/assets/lang/I18N_es.properties @@ -291,6 +291,7 @@ curse.sort.popularity=Popularidad curse.sort.total_downloads=Descargas totales download=Descargar +download.hint=Instalar juegos y modpacks o descargar mods, paquetes de recursos y mapas download.code.404=Archivo no encontrado en el servidor remoto: %s download.content=Complementos download.curseforge.customization=Luz y sombras, y personalización del juego @@ -1052,6 +1053,7 @@ version.game.snapshot=Snapshot version.game.snapshots=Snapshots version.launch=Iniciar Minecraft version.launch.test=Probar instalación +version.switch=Cambiar versión version.launch_script=Exportar script de ejecución version.launch_script.failed=No se ha podido exportar el script de ejecución. version.launch_script.save=Exportar script de ejecución diff --git a/HMCL/src/main/resources/assets/lang/I18N_ja.properties b/HMCL/src/main/resources/assets/lang/I18N_ja.properties index 69a4ccadc..600248a58 100644 --- a/HMCL/src/main/resources/assets/lang/I18N_ja.properties +++ b/HMCL/src/main/resources/assets/lang/I18N_ja.properties @@ -273,6 +273,7 @@ curse.sort.popularity=人気 curse.sort.total_downloads=合計ダウンロード数 download=ダウンロード +download.hint=ゲームや modpack をインストールするか、mod、リソース パック、マップをダウンロードします download.code.404=リモートサーバーにファイルが見つかりません:%s download.content=ゲームコンテンツ download.curseforge.customization=光と影、およびゲームのカスタマイズ @@ -882,6 +883,7 @@ version.game.snapshot=スナップショット version.game.snapshots=Snapshots version.launch=プレイ version.launch.test=テストプレイ +version.switch=バージョンを切り替える version.launch_script=起動スクリプトを作成する version.launch_script.failed=起動スクリプトを作成できません。 version.launch_script.save=起動スクリプトを保存する diff --git a/HMCL/src/main/resources/assets/lang/I18N_ru.properties b/HMCL/src/main/resources/assets/lang/I18N_ru.properties index d7ed0c43e..5a33071a3 100644 --- a/HMCL/src/main/resources/assets/lang/I18N_ru.properties +++ b/HMCL/src/main/resources/assets/lang/I18N_ru.properties @@ -275,6 +275,7 @@ curse.sort.popularity=Популярность curse.sort.total_downloads=Всего скачиваний download=Скачать +download.hint=Установите игры и пакеты модов или загрузите моды, пакеты ресурсов и карты download.code.404=Файл не найден на удалённом сервере: %s download.content=Игровой контент download.curseforge.customization=Свет и тень, а также настройка игры @@ -888,6 +889,7 @@ version.game.snapshot=Снапшот version.game.snapshots=Снапшоты version.launch=Играть version.launch.test=Тестовая игра +version.switch=Сменить версию version.launch_script=Создать сценарий запуска version.launch_script.failed=Невозможно выполнить сценарий запуска. version.launch_script.save=Сохранить сценарий запуска diff --git a/HMCL/src/main/resources/assets/lang/I18N_zh.properties b/HMCL/src/main/resources/assets/lang/I18N_zh.properties index 1d56c12d1..91e833bf0 100644 --- a/HMCL/src/main/resources/assets/lang/I18N_zh.properties +++ b/HMCL/src/main/resources/assets/lang/I18N_zh.properties @@ -315,6 +315,7 @@ curse.sort.popularity=熱度 curse.sort.total_downloads=下載量 download=下載 +download.hint=安裝遊戲和整合包或下載模組、資源包和地圖 download.code.404=遠端伺服器沒有需要下載的檔案: %s download.content=遊戲內容 download.curseforge.customization=光影與遊戲定制 @@ -1022,6 +1023,7 @@ version.game.snapshot=測試版本 version.game.snapshots=測試版本 version.launch=啟動遊戲 version.launch.test=測試遊戲 +version.switch=切換版本 version.launch_script=生成啟動指令碼 version.launch_script.failed=生成啟動指令碼失敗 version.launch_script.save=儲存啟動指令碼 diff --git a/HMCL/src/main/resources/assets/lang/I18N_zh_CN.properties b/HMCL/src/main/resources/assets/lang/I18N_zh_CN.properties index e412df06d..d93863a4f 100644 --- a/HMCL/src/main/resources/assets/lang/I18N_zh_CN.properties +++ b/HMCL/src/main/resources/assets/lang/I18N_zh_CN.properties @@ -314,6 +314,7 @@ curse.sort.popularity=热度 curse.sort.total_downloads=下载量 download=下载 +download.hint=安装游戏和整合包或下载模组、资源包和地图 download.code.404=远程服务器不包含需要下载的文件: %s download.content=游戏内容 download.curseforge.customization=光影与游戏定制 @@ -970,7 +971,7 @@ settings.type.global.manage=全局游戏设置 settings.type.global.edit=编辑全局版本设置 settings.type.special.enable=启用游戏特定设置(不影响其他游戏版本) settings.type.special.edit=编辑游戏特定设置 -settings.type.special.edit.hint=当前游戏版本 [%s] 启用了游戏特定设置,因此本页面选项不对该游戏生效。点击链接前往该游戏版本的游戏特定设置页 +settings.type.special.edit.hint=当前游戏版本 %s 启用了游戏特定设置,因此本页面选项不对该游戏生效。点击链接前往该游戏版本的游戏特定设置页 sponsor=赞助 sponsor.bmclapi=国内下载源由 BMCLAPI 和我的世界中文论坛 (MCBBS) 提供高速下载服务。BMCLAPI 为公益服务,赞助 BMCLAPI 可以帮助作者更好的提供稳定高速的下载服务,[点击此处查阅详细信息] @@ -1020,6 +1021,7 @@ version.game.snapshot=测试版 version.game.snapshots=测试版 version.launch=启动游戏 version.launch.test=测试游戏 +version.switch=切换版本 version.launch_script=生成启动脚本 version.launch_script.failed=生成启动脚本失败 version.launch_script.save=保存启动脚本