feat(ui): 优化游戏选择对话框和离线模式菜单

- 重构游戏选择对话框,使用列表控件替代复选框,提升用户体验。
- 添加全选按钮功能,简化游戏选择操作。
- 更新离线模式管理器和UI管理器,确保菜单状态与当前模式同步。
This commit is contained in:
hyb-oyqq
2025-08-06 17:51:37 +08:00
parent dfdeb54b43
commit 19cdd5b8cd
3 changed files with 33 additions and 106 deletions

View File

@@ -128,6 +128,13 @@ class OfflineModeManager:
# 同时更新UI中的标题标签
if hasattr(self.main_window, 'ui') and hasattr(self.main_window.ui, 'title_label'):
self.main_window.ui.title_label.setText(f"{APP_NAME} v{APP_VERSION} {mode_indicator}")
# 同步更新UI菜单中的模式选择状态
if hasattr(self.main_window, 'ui_manager'):
ui_manager = self.main_window.ui_manager
if hasattr(ui_manager, 'online_mode_action') and hasattr(ui_manager, 'offline_mode_action'):
ui_manager.online_mode_action.setChecked(not enabled)
ui_manager.offline_mode_action.setChecked(enabled)
if debug_mode:
logger.debug(f"DEBUG: 离线模式已{'启用' if enabled else '禁用'}")

View File

@@ -280,14 +280,19 @@ class UIManager:
self.work_mode_menu.setFont(menu_font)
self.work_mode_menu.setStyleSheet(self._get_menu_style(font_family))
# 获取当前离线模式状态
is_offline_mode = False
if hasattr(self.main_window, 'offline_mode_manager'):
is_offline_mode = self.main_window.offline_mode_manager.is_in_offline_mode()
# 创建在线模式和离线模式选项
self.online_mode_action = QAction("在线模式", self.main_window, checkable=True)
self.online_mode_action.setFont(menu_font)
self.online_mode_action.setChecked(True) # 默认选中在线模式
self.online_mode_action.setChecked(not is_offline_mode) # 根据当前状态设置
self.offline_mode_action = QAction("离线模式", self.main_window, checkable=True)
self.offline_mode_action.setFont(menu_font)
self.offline_mode_action.setChecked(False)
self.offline_mode_action.setChecked(is_offline_mode) # 根据当前状态设置
# 将两个模式选项添加到同一个互斥组
mode_group = QActionGroup(self.main_window)