From 7a8ecb06bf64f0cbc004d1cb14cfade94bb6100c Mon Sep 17 00:00:00 2001 From: hstyi Date: Thu, 30 Oct 2025 16:09:47 +0800 Subject: [PATCH] feat: add help message for removing shortcuts in keymap settings --- src/main/kotlin/app/termora/keymap/KeymapPanel.kt | 10 +++++++++- src/main/resources/i18n/messages.properties | 2 +- src/main/resources/i18n/messages_ru_RU.properties | 2 +- src/main/resources/i18n/messages_zh_CN.properties | 2 +- src/main/resources/i18n/messages_zh_TW.properties | 1 + 5 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/main/kotlin/app/termora/keymap/KeymapPanel.kt b/src/main/kotlin/app/termora/keymap/KeymapPanel.kt index c689c9c..8909448 100644 --- a/src/main/kotlin/app/termora/keymap/KeymapPanel.kt +++ b/src/main/kotlin/app/termora/keymap/KeymapPanel.kt @@ -29,8 +29,10 @@ class KeymapPanel : JPanel(BorderLayout()) { private val copyBtn = JButton(Icons.copy) private val renameBtn = JButton(Icons.edit) private val deleteBtn = JButton(Icons.delete) + private val infoBtn = JButton(Icons.questionMark) private val database get() = DatabaseManager.getInstance() private val allowKeyCodes = mutableSetOf() + private val owner get() = SwingUtilities.getWindowAncestor(this) init { initView() @@ -89,8 +91,8 @@ class KeymapPanel : JPanel(BorderLayout()) { box.add(copyBtn) box.add(renameBtn) box.add(deleteBtn) + box.add(infoBtn) box.add(Box.createHorizontalGlue()) - box.border = BorderFactory.createEmptyBorder(0, 0, 6, 0) add(box, BorderLayout.NORTH) add(scrollPane, BorderLayout.CENTER) @@ -105,6 +107,12 @@ class KeymapPanel : JPanel(BorderLayout()) { } }) + infoBtn.addActionListener { + val color = UIManager.getColor("TextField.placeholderForeground") + val msg = I18n.getString("termora.settings.keymap.question", color.red, color.green, color.blue) + OptionPane.showMessageDialog(owner, msg) + } + copyBtn.addActionListener { val keymap = getCurrentKeymap() if (keymap != null) { diff --git a/src/main/resources/i18n/messages.properties b/src/main/resources/i18n/messages.properties index d9415d9..01434c4 100644 --- a/src/main/resources/i18n/messages.properties +++ b/src/main/resources/i18n/messages.properties @@ -114,7 +114,7 @@ termora.settings.keymap=Keymap termora.settings.keymap.shortcut=Shortcut termora.settings.keymap.action=Action termora.settings.keymap.already-exists=The shortcut [{0}] is already in use by [{1}] - +termora.settings.keymap.question=Select a line, press the ⌫ (Backspace) key to remove the shortcut termora.settings.sftp.edit-command=Edit Command termora.settings.sftp.db-click-behavior=Double-click diff --git a/src/main/resources/i18n/messages_ru_RU.properties b/src/main/resources/i18n/messages_ru_RU.properties index f4c7e47..770ec96 100644 --- a/src/main/resources/i18n/messages_ru_RU.properties +++ b/src/main/resources/i18n/messages_ru_RU.properties @@ -99,7 +99,7 @@ termora.settings.keymap=Горяиче клавиши termora.settings.keymap.shortcut=Комбинация termora.settings.keymap.action=Команда termora.settings.keymap.already-exists=Комбинация [{0}] уже используется [{1}] - +termora.settings.keymap.question=Выберите строку и нажмите ⌫ (клавишу Backspace), чтобы удалить сочетание клавиш termora.settings.sftp.edit-command=Редактировать команду termora.settings.sftp.db-click-behavior=двойной щелчок diff --git a/src/main/resources/i18n/messages_zh_CN.properties b/src/main/resources/i18n/messages_zh_CN.properties index c30fb32..a374b35 100644 --- a/src/main/resources/i18n/messages_zh_CN.properties +++ b/src/main/resources/i18n/messages_zh_CN.properties @@ -125,7 +125,7 @@ termora.settings.keymap=键盘 termora.settings.keymap.shortcut=快捷键 termora.settings.keymap.action=操作 termora.settings.keymap.already-exists=快捷键 [{0}] 已经被 [{1}] 占用 - +termora.settings.keymap.question=选中一行,按下 ⌫ (退格键) 移除快捷键 termora.settings.sftp.edit-command=编辑命令 termora.settings.sftp.db-click-behavior=双击行为 diff --git a/src/main/resources/i18n/messages_zh_TW.properties b/src/main/resources/i18n/messages_zh_TW.properties index 8d02883..e9fbbed 100644 --- a/src/main/resources/i18n/messages_zh_TW.properties +++ b/src/main/resources/i18n/messages_zh_TW.properties @@ -55,6 +55,7 @@ termora.settings.keymap=鍵盤 termora.settings.keymap.shortcut=快捷鍵 termora.settings.keymap.action=操作 termora.settings.keymap.already-exists=快捷鍵 [{0}] 已經被 [{1}] 占用 +termora.settings.keymap.question=選取一行,按下 ⌫ (退格鍵) 移除快速鍵 termora.settings.sftp.edit-command=編輯命令 termora.settings.sftp.db-click-behavior=按兩下行為