feat(core): 更新窗口状态管理,统一使用window_manager

- 在多个模块中,将安装按钮状态管理从ui_manager迁移至window_manager,确保窗口状态的一致性和可维护性。
- 优化了ExtractionHandler、CloudflareOptimizer、DownloadManager、OfflineModeManager、PatchDetector等类中的状态更新逻辑,提升了代码的可读性和一致性。
This commit is contained in:
hyb-oyqq
2025-08-13 11:58:43 +08:00
parent 43a66f66a9
commit d07ef20e51
6 changed files with 56 additions and 83 deletions

View File

@@ -268,7 +268,8 @@ class PatchDetector:
QMessageBox.critical(self.main_window, f"文件校验失败 - {APP_NAME}", message)
self.main_window.setEnabled(True)
self.main_window.ui_manager.set_install_button_state("ready")
if hasattr(self.main_window, 'window_manager'):
self.main_window.window_manager.change_window_state(self.main_window.window_manager.STATE_READY)
QTimer.singleShot(100, self.main_window.show_result)
def on_offline_pre_hash_finished(self, updated_status, game_dirs):
@@ -333,7 +334,8 @@ class PatchDetector:
"\n未检测到任何需要安装补丁的游戏。\n\n请确保游戏文件夹位于选择的目录中。\n",
)
self.main_window.ui_manager.set_install_button_state("ready")
if hasattr(self.main_window, 'window_manager'):
self.main_window.window_manager.change_window_state(self.main_window.window_manager.STATE_READY)
return
from PySide6 import QtWidgets
@@ -367,7 +369,8 @@ class PatchDetector:
result = dialog.exec()
if result != QtWidgets.QDialog.DialogCode.Accepted or not list_widget.selectedItems():
self.main_window.ui_manager.set_install_button_state("ready")
if hasattr(self.main_window, 'window_manager'):
self.main_window.window_manager.change_window_state(self.main_window.window_manager.STATE_READY)
return
selected_games = [item.text() for item in list_widget.selectedItems()]