Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions electron-builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,12 @@ files:
filter:
- 'out/**' # 渲染进程打包后文件
- 'resources/**' # 运行时资源(如果需要)
- '!resources/media-server/**' # 由 extraResources 处理,确保在打包产物中保持解压状态
- 'package.json'
- '!**/*.map'
extraResources:
- from: resources/media-server
to: media-server
asarUnpack:
- resources/**
- '**/*.{metal,exp,lib}'
Expand Down
3 changes: 2 additions & 1 deletion src/renderer/src/i18n/label.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,8 @@ const shortcutKeys = [
'toggle_subtitle_panel',
'playback_rate_next',
'playback_rate_prev',
'copy_subtitle'
'copy_subtitle',
'toggle_auto_pause'
] as const

const shortcutKeyMap = shortcutKeys.reduce(
Expand Down
4 changes: 4 additions & 0 deletions src/renderer/src/i18n/locales/en-us.json
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@
"clear_shortcut": "Clear shortcut keys",
"clear_topic": "Clear messages",
"copy_last_message": "Copy the previous message",
"copy_subtitle": "Copy subtitle",
"enabled": "Enable",
"escape_fullscreen": "Exit full screen",
"exit_fullscreen": "Exit full screen",
Expand All @@ -228,6 +229,7 @@
"playback_rate_prev": "Previous favorite rate",
"press_shortcut": "Press the shortcut key",
"previous_subtitle": "Previous subtitle",
"replay_current_subtitle": "Replay current subtitle",
"reset_defaults": "Reset default shortcuts",
"reset_defaults_confirm": "Are you sure you want to reset all shortcuts?",
"reset_to_default": "Reset to default",
Expand All @@ -241,10 +243,12 @@
"show_settings": "Open settings",
"single_loop": "Loop playback",
"title": "Shortcut keys",
"toggle_auto_pause": "Toggle auto pause",
"toggle_fullscreen": "Switch to fullscreen",
"toggle_new_context": "Clear context",
"toggle_show_assistants": "Toggle assistant display",
"toggle_show_topics": "Switch topic display",
"toggle_subtitle_panel": "Toggle subtitle panel",
"volume_down": "Decrease volume",
"volume_up": "Increase the volume",
"zoom_in": "Zoom in interface",
Expand Down
1 change: 1 addition & 0 deletions src/renderer/src/i18n/locales/ja-jp.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@
"single_loop": "ループ再生",
"title": "ショートカットキー",
"toggle_fullscreen": "全画面表示に切り替えます",
"toggle_auto_pause": "自動一時停止の切り替え",
"toggle_new_context": "上下文をクリアする",
"toggle_show_assistants": "アシスタント表示の切り替え",
"toggle_show_topics": "トピックの切り替え表示",
Expand Down
1 change: 1 addition & 0 deletions src/renderer/src/i18n/locales/ru-ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
"single_loop": "циклическое воспроизведение",
"title": "Горячие клавиши",
"toggle_fullscreen": "переключить полноэкранный режим",
"toggle_auto_pause": "Переключить автоматическую паузу",
"toggle_new_context": "Очистить контекст",
"toggle_show_assistants": "Переключить отображение помощника",
"toggle_show_topics": "переключить отображение темы",
Expand Down
1 change: 1 addition & 0 deletions src/renderer/src/i18n/locales/zh-cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,7 @@
"toggle_show_assistants": "切换助手显示",
"toggle_show_topics": "切换话题显示",
"toggle_subtitle_panel": "切换字幕面板",
"toggle_auto_pause": "切换自动暂停",
"volume_down": "减小音量",
"volume_up": "增大音量",
"zoom_in": "放大界面",
Expand Down
1 change: 1 addition & 0 deletions src/renderer/src/i18n/locales/zh-tw.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
"title": "快捷鍵",
"toggle_fullscreen": "切換全屏",
"toggle_new_context": "清除上下文",
"toggle_auto_pause": "切換自動暫停",
"toggle_show_assistants": "切換助手顯示",
"toggle_show_topics": "切換話題顯示",
"toggle_subtitle_panel": "切換字幕面板",
Expand Down
7 changes: 7 additions & 0 deletions src/renderer/src/infrastructure/constants/shortcuts.const.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,5 +109,12 @@ export const DEFAULT_SHORTCUTS: Shortcut[] = [
editable: true,
enabled: true,
system: false
},
{
key: 'toggle_auto_pause',
shortcut: ['P'],
editable: true,
enabled: true,
system: false
}
]
12 changes: 11 additions & 1 deletion src/renderer/src/pages/player/hooks/usePlayerCommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ export function usePlayerCommands() {
const { orchestrator } = usePlayerEngine()
const subtitles = usePlayerSubtitlesStore((s) => s.subtitles)
const toggleLoopEnabled = usePlayerStore((s) => s.toggleLoopEnabled)
const autoPauseEnabled = usePlayerStore((s) => s.autoPauseEnabled)
const setAutoPauseEnabled = usePlayerStore((s) => s.setAutoPauseEnabled)

// 播放/暂停
const playPause = useCallback(async () => {
Expand Down Expand Up @@ -150,6 +152,13 @@ export function usePlayerCommands() {
logger.info('Command: toggleMute executed')
}, [orchestrator])

const toggleAutoPause = useCallback(() => {
setAutoPauseEnabled(!autoPauseEnabled)
logger.info('Command: toggleAutoPause executed', {
enabled: !autoPauseEnabled
})
}, [autoPauseEnabled, setAutoPauseEnabled])

// 播放速度
const setPlaybackRate = useCallback(
(rate: number) => {
Expand Down Expand Up @@ -300,6 +309,7 @@ export function usePlayerCommands() {
goToNextSubtitle,

// 功能控制
toggleLoopEnabled
toggleLoopEnabled,
toggleAutoPause
}
}
6 changes: 6 additions & 0 deletions src/renderer/src/pages/player/hooks/usePlayerShortcuts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,12 @@ export function usePlayerShortcuts() {
cmd.toggleLoopEnabled()
})

// 自动暂停切换
useShortcut('toggle_auto_pause', () => {
cmd.toggleAutoPause()
logger.info('自动暂停功能切换')
})

// 字幕面板切换
useShortcut('toggle_subtitle_panel', () => {
toggleSubtitlePanel()
Expand Down
Loading