feat: 保存并登记当前 Client (#11)

This commit is contained in:
chengma
2026-08-06 17:57:49 +08:00
parent 262f48c778
commit fab5778049
17 changed files with 1078 additions and 43 deletions
+21 -2
View File
@@ -201,7 +201,12 @@ class AndroidDeviceTableModel(QAbstractTableModel):
class SettingsPage(QWidget):
"""设备管理与后续应用设置的统一页面。"""
def __init__(self, parent=None):
def __init__(
self,
parent=None,
settings_repository=None,
admin_gateway=None,
):
super().__init__(parent)
self.setObjectName("settingsPage")
self._build_ui()
@@ -209,7 +214,11 @@ class SettingsPage(QWidget):
# 延迟到控件创建完成后绑定,避免事件层在构造过程中访问半成品页面。
from .settings_ui_event import SettingsPageEventBinder
self.eventBinder = SettingsPageEventBinder(self)
self.eventBinder = SettingsPageEventBinder(
self,
settings_repository=settings_repository,
admin_gateway=admin_gateway,
)
def _build_ui(self) -> None:
self.deviceIdInput = LineEdit(self)
@@ -225,6 +234,10 @@ class SettingsPage(QWidget):
self.currentDeviceSaveButton = PushButton(FIF.SAVE, "保存", self)
self.currentDeviceSaveButton.setAccessibleName("保存当前设备信息")
self.currentDeviceStatusLabel = CaptionLabel(
"设备信息尚未保存", self
)
self.currentDeviceStatusLabel.setAccessibleName("当前设备保存状态")
self.currentDeviceCard = self._build_current_device_card()
@@ -322,6 +335,7 @@ class SettingsPage(QWidget):
commandLayout.addStretch(1)
commandLayout.addWidget(self.currentDeviceSaveButton)
layout.addLayout(commandLayout)
layout.addWidget(self.currentDeviceStatusLabel)
return card
def _build_android_device_card(self) -> CardWidget:
@@ -357,6 +371,11 @@ class SettingsPage(QWidget):
self.deviceIdInput.setText(device_id or "待生成")
self.deviceNameInput.setText(device_name)
def set_current_device_status(self, message: str) -> None:
"""显示本地保存和 Admin 登记两个阶段的结果。"""
self.currentDeviceStatusLabel.setText(message)
def set_android_devices(self, devices: Iterable[AndroidDeviceRow]) -> None:
"""显示后续 ADB 服务返回的设备列表。"""