From b35469875d9245e143e25aefc7b73f9c9496600e Mon Sep 17 00:00:00 2001 From: shuaijie Date: Mon, 25 Nov 2024 22:02:33 +0800 Subject: [PATCH 01/69] chore: uniform some arm model code uniform some model arm code Log: uniform some arm model code Bug: https://pms.uniontech.com/task-view-368603.html --- .../oeminfo_sampleAnduseGuideLine_zh_CN.toml | 5 +- .../src/DeviceManager/DeviceAudio.cpp | 60 +- .../src/DeviceManager/DeviceBios.cpp | 140 +- .../src/DeviceManager/DeviceBluetooth.cpp | 86 +- .../src/DeviceManager/DeviceCdrom.cpp | 50 +- .../src/DeviceManager/DeviceComputer.cpp | 2 +- .../src/DeviceManager/DeviceCpu.cpp | 66 +- .../src/DeviceManager/DeviceGpu.cpp | 84 +- .../src/DeviceManager/DeviceImage.cpp | 24 +- .../src/DeviceManager/DeviceInfo.cpp | 171 +- .../src/DeviceManager/DeviceInfo.h | 45 +- .../src/DeviceManager/DeviceInput.cpp | 77 +- .../src/DeviceManager/DeviceInput.h | 6 - .../src/DeviceManager/DeviceManager.cpp | 109 +- .../src/DeviceManager/DeviceManager.h | 12 +- .../src/DeviceManager/DeviceMemory.cpp | 78 +- .../src/DeviceManager/DeviceMonitor.cpp | 43 +- .../src/DeviceManager/DeviceMonitor.h | 7 +- .../src/DeviceManager/DeviceNetwork.cpp | 68 +- .../src/DeviceManager/DeviceOtherPCI.cpp | 26 +- .../src/DeviceManager/DeviceOthers.cpp | 24 +- .../src/DeviceManager/DevicePower.cpp | 87 +- .../src/DeviceManager/DevicePrint.cpp | 50 +- .../src/DeviceManager/DeviceStorage.cpp | 136 +- .../src/DeviceManager/DeviceStorage.h | 15 - .../src/GenerateDevice/CmdTool.cpp | 7 +- .../src/GenerateDevice/DeviceFactory.cpp | 6 +- .../src/GenerateDevice/DeviceGenerator.cpp | 87 +- .../src/GenerateDevice/HWGenerator.cpp | 335 +- .../src/GenerateDevice/HWGenerator.h | 40 +- .../src/GenerateDevice/KLUGenerator.cpp | 180 - .../src/GenerateDevice/KLUGenerator.h | 36 - .../src/GenerateDevice/KLVGenerator.cpp | 229 - .../src/GenerateDevice/KLVGenerator.h | 49 - .../src/GenerateDevice/PanguxGenerator.cpp | 2 +- deepin-devicemanager/src/MacroDefinition.h | 16 +- .../src/Page/PageBoardInfo.cpp | 10 +- deepin-devicemanager/src/Page/PageDetail.cpp | 2 +- .../src/Page/PageSingleInfo.cpp | 4 +- .../src/Widget/TextBrowser.cpp | 6 +- deepin-devicemanager/src/commonfunction.cpp | 20 + deepin-devicemanager/src/commonfunction.h | 3 +- .../src/DeviceManager/ut_deviceinput.cpp | 40 - .../src/DeviceManager/ut_devicemanager.cpp | 15 +- .../src/DeviceManager/ut_devicemonitor.cpp | 15 - .../src/DeviceManager/ut_devicenetwork.cpp | 4 +- .../src/DeviceManager/ut_devicestorage.cpp | 78 - .../src/GenerateDevice/ut_klugenerator.cpp | 2 - .../translations/deepin-devicemanager.ts | 4 +- .../deepin-devicemanager_zh_CN.ts | 4913 +++++++---------- 50 files changed, 3191 insertions(+), 4383 deletions(-) delete mode 100644 deepin-devicemanager/src/GenerateDevice/KLUGenerator.cpp delete mode 100644 deepin-devicemanager/src/GenerateDevice/KLUGenerator.h delete mode 100644 deepin-devicemanager/src/GenerateDevice/KLVGenerator.cpp delete mode 100644 deepin-devicemanager/src/GenerateDevice/KLVGenerator.h diff --git a/deepin-devicemanager/assets/oeminfo_sampleAnduseGuideLine_zh_CN.toml b/deepin-devicemanager/assets/oeminfo_sampleAnduseGuideLine_zh_CN.toml index 427ae3fa0..abcd1460a 100755 --- a/deepin-devicemanager/assets/oeminfo_sampleAnduseGuideLine_zh_CN.toml +++ b/deepin-devicemanager/assets/oeminfo_sampleAnduseGuideLine_zh_CN.toml @@ -245,7 +245,7 @@ GPU vendor ="toml_GPU vendor" #29 : GPU GPU type ="toml_GPU type" #30 : GPU类型 SubVendor ="toml_SubVendor" #31 : 子制造商 SubDevice ="toml_SubDevice" #32 : 子设备 -latency ="toml_latency" #33 : 延迟 +Latency ="toml_latency" #33 : 延迟 Device ="toml_Device" #34 : 设备 Config Status ="toml_Config Status" #35 : 配置状态 Driver Modules ="toml_Driver Modules" #36 : 驱动模块 @@ -263,6 +263,7 @@ Display Ratio ="toml_Display Ratio" #9 : 显 Current Resolution ="toml_Current Resolution" #10 : 当前分辨率 Support Resolution ="toml_Support Resolution" #11 : 支持分辨率 Date ="toml_Date" #12 : 日期 +Refresh Rate ="toml_Refresh Rate" #13 : 支持的屏幕刷新率 [NetWork.flagLabel] #(网络适配器) Name ="toml_Name" #1 : 名称 @@ -311,7 +312,7 @@ Sysfs ="toml_Sysfs" #16 : Sysfs Handlers ="toml_Handlers" #17 : 处理程序 SubVendor ="toml_SubVendor" #18 : 子制造商 SubDevice ="toml_SubDevice" #19 : 子设备 -latency ="toml_latency" #20 : 延迟 +Latency ="toml_latency" #20 : 延迟 Bus ="toml_Bus" #21 : 总线 Version ="toml_Version" #22 : 版本 Config Status ="toml_Config Status" #23 : 配置状态 diff --git a/deepin-devicemanager/src/DeviceManager/DeviceAudio.cpp b/deepin-devicemanager/src/DeviceManager/DeviceAudio.cpp index 067fa586c..30ecd8a4f 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceAudio.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceAudio.cpp @@ -304,44 +304,44 @@ const QString DeviceAudio::getOverviewInfo() void DeviceAudio::initFilterKey() { // 添加可显示的属性 - addFilterKey(tr("Device Name")); - addFilterKey(QObject::tr("SubVendor")); - addFilterKey(QObject::tr("SubDevice")); - addFilterKey(QObject::tr("Driver Status")); - addFilterKey(QObject::tr("Driver Activation Cmd")); - addFilterKey(QObject::tr("Config Status")); - addFilterKey(QObject::tr("latency")); - addFilterKey(QObject::tr("Phys")); - addFilterKey(QObject::tr("Sysfs")); - addFilterKey(QObject::tr("Handlers")); - addFilterKey(QObject::tr("PROP")); - addFilterKey(QObject::tr("EV")); - addFilterKey(QObject::tr("KEY")); - addFilterKey(QObject::tr("Bus")); - addFilterKey(QObject::tr("Version")); - addFilterKey(QObject::tr("Driver")); + addFilterKey("Device Name"); + addFilterKey("SubVendor"); + addFilterKey("SubDevice"); + addFilterKey("Driver Status"); + addFilterKey("Driver Activation Cmd"); + addFilterKey("Config Status"); + addFilterKey("latency"); + addFilterKey("Phys"); + addFilterKey("Sysfs"); + addFilterKey("Handlers"); + addFilterKey("PROP"); + addFilterKey("EV"); + addFilterKey("KEY"); + addFilterKey("Bus"); + addFilterKey("Version"); + addFilterKey("Driver"); } void DeviceAudio::loadBaseDeviceInfo() { // 添加基本信息 - addBaseDeviceInfo(tr("Name"), m_Name); - addBaseDeviceInfo(tr("Vendor"), m_Vendor); - addBaseDeviceInfo(tr("SysFS_Path"), m_SysPath); - addBaseDeviceInfo(tr("Description"), m_Description); - addBaseDeviceInfo(tr("Revision"), m_Version); - addBaseDeviceInfo(tr("KernelModeDriver"), m_Driver); + addBaseDeviceInfo(("Name"), m_Name); + addBaseDeviceInfo(("Vendor"), m_Vendor); + addBaseDeviceInfo(("SysFS_Path"), m_SysPath); + addBaseDeviceInfo(("Description"), m_Description); + addBaseDeviceInfo(("Revision"), m_Version); + addBaseDeviceInfo(("KernelModeDriver"), m_Driver); } void DeviceAudio::loadOtherDeviceInfo() { // 添加其他信息,成员变量 - addOtherDeviceInfo(tr("Module Alias"), m_Modalias); - addOtherDeviceInfo(tr("Physical ID"), m_PhysID); - addOtherDeviceInfo(tr("Chip"), m_Chip); - addOtherDeviceInfo(tr("Capabilities"), m_Capabilities); - addOtherDeviceInfo(tr("Memory Address"), m_Memory); // 1050需求 内存改为内存地址 - addOtherDeviceInfo(tr("IRQ"), m_Irq); + addOtherDeviceInfo(("Module Alias"), m_Modalias); + addOtherDeviceInfo(("Physical ID"), m_PhysID); + addOtherDeviceInfo(("Chip"), m_Chip); + addOtherDeviceInfo(("Capabilities"), m_Capabilities); + addOtherDeviceInfo(("Memory Address"), m_Memory); // 1050需求 内存改为内存地址 + addOtherDeviceInfo(("IRQ"), m_Irq); // 将QMap内容转存为QList> mapInfoToList(); } @@ -349,8 +349,8 @@ void DeviceAudio::loadOtherDeviceInfo() void DeviceAudio::loadTableHeader() { // 表头信息 - m_TableHeader.append(tr("Name")); - m_TableHeader.append(tr("Vendor")); + m_TableHeader.append("Name"); + m_TableHeader.append("Vendor"); } void DeviceAudio::loadTableData() diff --git a/deepin-devicemanager/src/DeviceManager/DeviceBios.cpp b/deepin-devicemanager/src/DeviceManager/DeviceBios.cpp index d734314ad..3a8613b33 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceBios.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceBios.cpp @@ -39,7 +39,7 @@ bool DeviceBios::setBiosInfo(const QMap &mapInfo) return false; // 获取BIOS信息 - m_Name = QObject::tr("BIOS Information"); + m_Name = ("BIOS Information"); m_tomlName = ("BIOS Information"); setAttribute(mapInfo, "Vendor", m_Vendor); setAttribute(mapInfo, "Version", m_Version); @@ -61,7 +61,7 @@ bool DeviceBios::setBaseBoardInfo(const QMap &mapInfo) return false; // 获取主板信息 - m_Name = QObject::tr("Base Board Information"); + m_Name = ("Base Board Information"); m_tomlName = ("Base Board Information"); setAttribute(mapInfo, "Manufacturer", m_Vendor); setAttribute(mapInfo, "Version", m_Version); @@ -83,7 +83,7 @@ bool DeviceBios::setSystemInfo(const QMap &mapInfo) return false; // 获取系统信息 - m_Name = QObject::tr("System Information"); + m_Name = ("System Information"); m_tomlName = ("System Information"); setAttribute(mapInfo, "Manufacturer", m_Vendor); setAttribute(mapInfo, "Version", m_Version); @@ -99,7 +99,7 @@ bool DeviceBios::setChassisInfo(const QMap &mapInfo) return false; // 获取机箱信息 - m_Name = QObject::tr("Chassis Information"); + m_Name = ("Chassis Information"); m_tomlName = ("Chassis Information"); setAttribute(mapInfo, "Manufacturer", m_Vendor); setAttribute(mapInfo, "Version", m_Version); @@ -115,7 +115,7 @@ bool DeviceBios::setMemoryInfo(const QMap &mapInfo) return false; // 获取内存插槽信息 - m_Name = QObject::tr("Physical Memory Array"); + m_Name = ("Physical Memory Array"); m_tomlName = ("Physical Memory Array"); setAttribute(mapInfo, "Manufacturer", m_Vendor); setAttribute(mapInfo, "Version", m_Version); @@ -157,7 +157,7 @@ bool DeviceBios::isBoard()const QString DeviceBios::subTitle() { - return m_Name; + return QObject::tr(m_Name.toLatin1()); } const QString DeviceBios::getOverviewInfo() @@ -173,76 +173,76 @@ void DeviceBios::initFilterKey() { // 添加可显示属性 - addFilterKey(QObject::tr("Release Date")); - addFilterKey(QObject::tr("Address")); - addFilterKey(QObject::tr("Runtime Size")); - addFilterKey(QObject::tr("ROM Size")); - addFilterKey(QObject::tr("Characteristics")); - addFilterKey(QObject::tr("BIOS Revision")); - addFilterKey(QObject::tr("Firmware Revision")); - - addFilterKey(QObject::tr("Product Name")); - addFilterKey(QObject::tr("Serial Number")); - addFilterKey(QObject::tr("Asset Tag")); - addFilterKey(QObject::tr("Features")); - addFilterKey(QObject::tr("Location In Chassis")); - addFilterKey(QObject::tr("Chassis Handle")); - addFilterKey(QObject::tr("Type")); - addFilterKey(QObject::tr("Contained Object Handles")); - - addFilterKey(QObject::tr("Product Name")); - addFilterKey(QObject::tr("Serial Number")); - addFilterKey(QObject::tr("UUID")); - addFilterKey(QObject::tr("Wake-up Type")); - addFilterKey(QObject::tr("SKU Number")); - addFilterKey(QObject::tr("Family")); - - - addFilterKey(QObject::tr("Type")); - addFilterKey(QObject::tr("Lock")); - addFilterKey(QObject::tr("Serial Number")); - addFilterKey(QObject::tr("Asset Tag")); - addFilterKey(QObject::tr("Boot-up State")); - addFilterKey(QObject::tr("Power Supply State")); - addFilterKey(QObject::tr("Thermal State")); - addFilterKey(QObject::tr("Security Status")); - addFilterKey(QObject::tr("OEM Information")); - addFilterKey(QObject::tr("Height")); - addFilterKey(QObject::tr("Number Of Power Cords")); - addFilterKey(QObject::tr("Contained Elements")); - addFilterKey(QObject::tr("SKU Number")); - - addFilterKey(QObject::tr("Location")); - addFilterKey(QObject::tr("Error Correction Type")); - addFilterKey(QObject::tr("Maximum Capacity")); - addFilterKey(QObject::tr("Error Information Handle")); - addFilterKey(QObject::tr("Number Of Devices")); - - addFilterKey(QObject::tr("BIOS ROMSIZE")); - addFilterKey(QObject::tr("Release date")); - addFilterKey(QObject::tr("Board name")); - addFilterKey(QObject::tr("Family")); - - addFilterKey(QObject::tr("BIOS Information")); - addFilterKey(QObject::tr("Base Board Information")); - addFilterKey(QObject::tr("System Information")); - addFilterKey(QObject::tr("Chassis Information")); - addFilterKey(QObject::tr("Physical Memory Array")); - - addFilterKey(QObject::tr("SMBIOS Version")); - - addFilterKey(QObject::tr("Language Description Format")); - addFilterKey(QObject::tr("Installable Languages")); - addFilterKey(QObject::tr("Currently Installed Language")); + addFilterKey("Release Date"); + addFilterKey("Address"); + addFilterKey("Runtime Size"); + addFilterKey("ROM Size"); + addFilterKey("Characteristics"); + addFilterKey("BIOS Revision"); + addFilterKey("Firmware Revision"); + + addFilterKey("Product Name"); + addFilterKey("Serial Number"); + addFilterKey("Asset Tag"); + addFilterKey("Features"); + addFilterKey("Location In Chassis"); + addFilterKey("Chassis Handle"); + addFilterKey("Type"); + addFilterKey("Contained Object Handles"); + + addFilterKey("Product Name"); + addFilterKey("Serial Number"); + addFilterKey("UUID"); + addFilterKey("Wake-up Type"); + addFilterKey("SKU Number"); + addFilterKey("Family"); + + + addFilterKey("Type"); + addFilterKey("Lock"); + addFilterKey("Serial Number"); + addFilterKey("Asset Tag"); + addFilterKey("Boot-up State"); + addFilterKey("Power Supply State"); + addFilterKey("Thermal State"); + addFilterKey("Security Status"); + addFilterKey("OEM Information"); + addFilterKey("Height"); + addFilterKey("Number Of Power Cords"); + addFilterKey("Contained Elements"); + addFilterKey("SKU Number"); + + addFilterKey("Location"); + addFilterKey("Error Correction Type"); + addFilterKey("Maximum Capacity"); + addFilterKey("Error Information Handle"); + addFilterKey("Number Of Devices"); + + addFilterKey("BIOS ROMSIZE"); + addFilterKey("Release date"); + addFilterKey("Board name"); + addFilterKey("Family"); + + addFilterKey("BIOS Information"); + addFilterKey("Base Board Information"); + addFilterKey("System Information"); + addFilterKey("Chassis Information"); + addFilterKey("Physical Memory Array"); + + addFilterKey("SMBIOS Version"); + + addFilterKey("Language Description Format"); + addFilterKey("Installable Languages"); + addFilterKey("Currently Installed Language"); } void DeviceBios::loadBaseDeviceInfo() { // 添加基本信息 - addBaseDeviceInfo(tr("Vendor"), m_Vendor); - addBaseDeviceInfo(tr("Version"), m_Version); - addBaseDeviceInfo(tr("Chipset"), m_ChipsetFamily); + addBaseDeviceInfo(("Vendor"), m_Vendor); + addBaseDeviceInfo(("Version"), m_Version); + addBaseDeviceInfo(("Chipset"), m_ChipsetFamily); } void DeviceBios::loadOtherDeviceInfo() diff --git a/deepin-devicemanager/src/DeviceManager/DeviceBluetooth.cpp b/deepin-devicemanager/src/DeviceManager/DeviceBluetooth.cpp index 0d518380c..1dd0a01c4 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceBluetooth.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceBluetooth.cpp @@ -204,59 +204,59 @@ bool DeviceBluetooth::enable() void DeviceBluetooth::initFilterKey() { // 添加可显示的属性 - addFilterKey(QObject::tr("Bus")); - addFilterKey(QObject::tr("BD Address")); - addFilterKey(QObject::tr("ACL MTU")); - addFilterKey(QObject::tr("SCO MTU")); - addFilterKey(QObject::tr("Features")); - addFilterKey(QObject::tr("Packet type")); - addFilterKey(QObject::tr("Link policy")); - addFilterKey(QObject::tr("Link mode")); - addFilterKey(QObject::tr("Class")); - addFilterKey(QObject::tr("Service Classes")); - addFilterKey(QObject::tr("Device Class")); - addFilterKey(QObject::tr("HCI Version")); - addFilterKey(QObject::tr("LMP Version")); - addFilterKey(QObject::tr("Subversion")); - - addFilterKey(QObject::tr("Device")); - addFilterKey(QObject::tr("Serial ID")); - - addFilterKey(QObject::tr("product")); - addFilterKey(QObject::tr("description")); - // addFilterKey(QObject::tr("physical id")); - addFilterKey(QObject::tr("Class")); - addFilterKey(QObject::tr("Powered")); - addFilterKey(QObject::tr("Discoverable")); - addFilterKey(QObject::tr("Pairable")); - addFilterKey(QObject::tr("UUID")); - addFilterKey(QObject::tr("Modalias")); - addFilterKey(QObject::tr("Discovering")); + addFilterKey("Bus"); + addFilterKey("BD Address"); + addFilterKey("ACL MTU"); + addFilterKey("SCO MTU"); + addFilterKey("Features"); + addFilterKey("Packet type"); + addFilterKey("Link policy"); + addFilterKey("Link mode"); + addFilterKey("Class"); + addFilterKey("Service Classes"); + addFilterKey("Device Class"); + addFilterKey("HCI Version"); + addFilterKey("LMP Version"); + addFilterKey("Subversion"); + + addFilterKey("Device"); + addFilterKey("Serial ID"); + + addFilterKey("product"); + addFilterKey("description"); + // addFilterKey("physical id"); + addFilterKey("Class"); + addFilterKey("Powered"); + addFilterKey("Discoverable"); + addFilterKey("Pairable"); + addFilterKey("UUID"); + addFilterKey("Modalias"); + addFilterKey("Discovering"); } void DeviceBluetooth::loadBaseDeviceInfo() { // 添加基本信息 - addBaseDeviceInfo(tr("Alias"), m_Alias); - addBaseDeviceInfo(tr("Name"), m_Name); - addBaseDeviceInfo(tr("Vendor"), m_Vendor); - addBaseDeviceInfo(tr("Version"), m_Version); - addBaseDeviceInfo(tr("Model"), m_Model); + addBaseDeviceInfo(("Alias"), m_Alias); + addBaseDeviceInfo(("Name"), m_Name); + addBaseDeviceInfo(("Vendor"), m_Vendor); + addBaseDeviceInfo(("Version"), m_Version); + addBaseDeviceInfo(("Model"), m_Model); } void DeviceBluetooth::loadOtherDeviceInfo() { // 添加其他信息,成员变量 - addOtherDeviceInfo(tr("Module Alias"), m_Modalias); - addOtherDeviceInfo(tr("Physical ID"), m_PhysID); - addOtherDeviceInfo(tr("Speed"), m_Speed); - addOtherDeviceInfo(tr("Maximum Power"), m_MaximumPower); - addOtherDeviceInfo(tr("Driver Version"), m_DriverVersion); - addOtherDeviceInfo(tr("Driver"), m_Driver); - addOtherDeviceInfo(tr("Capabilities"), m_Capabilities); - addOtherDeviceInfo(tr("Bus Info"), m_BusInfo); - addOtherDeviceInfo(tr("Logical Name"), m_LogicalName); - addOtherDeviceInfo(tr("MAC Address"), m_MAC); + addOtherDeviceInfo(("Module Alias"), m_Modalias); + addOtherDeviceInfo(("Physical ID"), m_PhysID); + addOtherDeviceInfo(("Speed"), m_Speed); + addOtherDeviceInfo(("Maximum Power"), m_MaximumPower); + addOtherDeviceInfo(("Driver Version"), m_DriverVersion); + addOtherDeviceInfo(("Driver"), m_Driver); + addOtherDeviceInfo(("Capabilities"), m_Capabilities); + addOtherDeviceInfo(("Bus Info"), m_BusInfo); + addOtherDeviceInfo(("Logical Name"), m_LogicalName); + addOtherDeviceInfo(("MAC Address"), m_MAC); // 将QMap内容转存为QList> mapInfoToList(); diff --git a/deepin-devicemanager/src/DeviceManager/DeviceCdrom.cpp b/deepin-devicemanager/src/DeviceManager/DeviceCdrom.cpp index 9f8eae772..b93c0005f 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceCdrom.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceCdrom.cpp @@ -105,41 +105,41 @@ const QString DeviceCdrom::getOverviewInfo() void DeviceCdrom::initFilterKey() { // 添加可显示的属性 - addFilterKey(QObject::tr("Serial ID")); - addFilterKey(QObject::tr("Driver Modules")); - addFilterKey(QObject::tr("Device File")); - addFilterKey(QObject::tr("Device Files")); - addFilterKey(QObject::tr("Device Number")); - // addFilterKey(QObject::tr("Module Alias")); - addFilterKey(QObject::tr("Config Status")); - addFilterKey(QObject::tr("Application")); - // addFilterKey(QObject::tr("physical id")); - - addFilterKey(QObject::tr("status")); - addFilterKey(QObject::tr("logical name")); -// addFilterKey(QObject::tr("bus info")); - addFilterKey(QObject::tr("ansiversion")); + addFilterKey("Serial ID"); + addFilterKey("Driver Modules"); + addFilterKey("Device File"); + addFilterKey("Device Files"); + addFilterKey("Device Number"); + // addFilterKey("Module Alias"); + addFilterKey("Config Status"); + addFilterKey("Application"); + // addFilterKey("physical id"); + + addFilterKey("status"); + addFilterKey("logical name"); +// addFilterKey("bus info"); + addFilterKey("ansiversion"); } void DeviceCdrom::loadBaseDeviceInfo() { // 添加基本信息 - addBaseDeviceInfo(tr("Name"), m_Name); - addBaseDeviceInfo(tr("Vendor"), m_Vendor); - addBaseDeviceInfo(tr("Model"), m_Type); - addBaseDeviceInfo(tr("Version"), m_Version); - addBaseDeviceInfo(tr("Bus Info"), m_BusInfo); - addBaseDeviceInfo(tr("Capabilities"), m_Capabilities); - addBaseDeviceInfo(tr("Driver"), m_Driver); - addBaseDeviceInfo(tr("Maximum Power"), m_MaxPower); - addBaseDeviceInfo(tr("Speed"), m_Speed); + addBaseDeviceInfo(("Name"), m_Name); + addBaseDeviceInfo(("Vendor"), m_Vendor); + addBaseDeviceInfo(("Model"), m_Type); + addBaseDeviceInfo(("Version"), m_Version); + addBaseDeviceInfo(("Bus Info"), m_BusInfo); + addBaseDeviceInfo(("Capabilities"), m_Capabilities); + addBaseDeviceInfo(("Driver"), m_Driver); + addBaseDeviceInfo(("Maximum Power"), m_MaxPower); + addBaseDeviceInfo(("Speed"), m_Speed); } void DeviceCdrom::loadOtherDeviceInfo() { - addOtherDeviceInfo(tr("Module Alias"), m_Modalias); - addOtherDeviceInfo(tr("Physical ID"), m_PhysID); + addOtherDeviceInfo(("Module Alias"), m_Modalias); + addOtherDeviceInfo(("Physical ID"), m_PhysID); // 将QMap内容转存为QList> mapInfoToList(); } diff --git a/deepin-devicemanager/src/DeviceManager/DeviceComputer.cpp b/deepin-devicemanager/src/DeviceManager/DeviceComputer.cpp index 337bdb1a3..5fc1c890e 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceComputer.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceComputer.cpp @@ -160,7 +160,7 @@ void DeviceComputer::initFilterKey() void DeviceComputer::loadBaseDeviceInfo() { // 添加基本信息 - addBaseDeviceInfo(tr("Name"), m_Name); + addBaseDeviceInfo(("Name"), m_Name); } void DeviceComputer::loadOtherDeviceInfo() diff --git a/deepin-devicemanager/src/DeviceManager/DeviceCpu.cpp b/deepin-devicemanager/src/DeviceManager/DeviceCpu.cpp index 133499cb8..d80787613 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceCpu.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceCpu.cpp @@ -54,27 +54,27 @@ void DeviceCpu::setCpuInfo(const QMap &mapLscpu, const QMap &m ret = setTomlAttribute(mapInfo, "Core ID", m_CoreID); ret = setTomlAttribute(mapInfo, "Threads", m_ThreadNum); ret = setTomlAttribute(mapInfo, "Frequency", m_Frequency); - ret = setTomlAttribute(mapInfo, "Current Speed", m_CurFrequency); - ret = setTomlAttribute(mapInfo, "Max Speed", m_MaxFrequency); + ret = setTomlAttribute(mapInfo, "Current Frequency", m_CurFrequency); + ret = setTomlAttribute(mapInfo, "Max Frequency", m_MaxFrequency); ret = setTomlAttribute(mapInfo, "BogoMIPS", m_BogoMIPS); ret = setTomlAttribute(mapInfo, "Architecture", m_Architecture); ret = setTomlAttribute(mapInfo, "CPU Family", m_Familly); @@ -267,15 +267,15 @@ void DeviceCpu::loadOtherDeviceInfo() { // 倒序,头插,保证原来的顺序 // 添加其他信息,成员变量 - addOtherDeviceInfo(tr("Virtualization"), m_HardwareVirtual); - addOtherDeviceInfo(tr("Flags"), m_Flags); - addOtherDeviceInfo(tr("Extensions"), m_Extensions); - addOtherDeviceInfo(tr("L4 Cache"), m_CacheL4); - addOtherDeviceInfo(tr("L3 Cache"), m_CacheL3); - addOtherDeviceInfo(tr("L2 Cache"), m_CacheL2); - addOtherDeviceInfo(tr("L1i Cache"), m_CacheL1Order); - addOtherDeviceInfo(tr("L1d Cache"), m_CacheL1Data); - addOtherDeviceInfo(tr("Stepping"), m_Step); + addOtherDeviceInfo(("Virtualization"), m_HardwareVirtual); + addOtherDeviceInfo(("Flags"), m_Flags); + addOtherDeviceInfo(("Extensions"), m_Extensions); + addOtherDeviceInfo(("L4 Cache"), m_CacheL4); + addOtherDeviceInfo(("L3 Cache"), m_CacheL3); + addOtherDeviceInfo(("L2 Cache"), m_CacheL2); + addOtherDeviceInfo(("L1i Cache"), m_CacheL1Order); + addOtherDeviceInfo(("L1d Cache"), m_CacheL1Data); + addOtherDeviceInfo(("Stepping"), m_Step); // 将QMap内容转存为QList> mapInfoToList(); @@ -284,10 +284,10 @@ void DeviceCpu::loadOtherDeviceInfo() void DeviceCpu::loadTableHeader() { // 加载表头 - m_TableHeader.append(tr("Name")); - m_TableHeader.append(tr("Vendor")); - m_TableHeader.append(frequencyIsRange() ? tr("Speed") : tr("Max Speed")); - m_TableHeader.append(tr("Architecture")); + m_TableHeader.append("Name"); + m_TableHeader.append("Vendor"); + m_TableHeader.append(frequencyIsRange() ? ("Frequency") : ("Max Frequency")); + m_TableHeader.append("Architecture"); } void DeviceCpu::loadTableData() diff --git a/deepin-devicemanager/src/DeviceManager/DeviceGpu.cpp b/deepin-devicemanager/src/DeviceManager/DeviceGpu.cpp index 00d9aaed4..841418fb4 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceGpu.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceGpu.cpp @@ -36,21 +36,21 @@ DeviceGpu::DeviceGpu() void DeviceGpu::initFilterKey() { // 添加可显示属性 - addFilterKey(QObject::tr("Device")); - addFilterKey(QObject::tr("SubVendor")); - addFilterKey(QObject::tr("SubDevice")); - addFilterKey(QObject::tr("Driver Modules")); - addFilterKey(QObject::tr("Config Status")); - addFilterKey(QObject::tr("latency")); - - // gpuinfo 华为KLU和PanGuV - addFilterKey(QObject::tr("GDDR capacity")); - addFilterKey(QObject::tr("GPU vendor")); - addFilterKey(QObject::tr("GPU type")); - addFilterKey(QObject::tr("EGL version")); - addFilterKey(QObject::tr("EGL client APIs")); - addFilterKey(QObject::tr("GL version")); - addFilterKey(QObject::tr("GLSL version")); + addFilterKey("Device"); + addFilterKey("SubVendor"); + addFilterKey("SubDevice"); + addFilterKey("Driver Modules"); + addFilterKey("Config Status"); + addFilterKey("Latency"); + + // gpuinfo + addFilterKey("GDDR capacity"); + addFilterKey("GPU vendor"); + addFilterKey("GPU type"); + addFilterKey("EGL version"); + addFilterKey("EGL client APIs"); + addFilterKey("GL version"); + addFilterKey("GLSL version"); } @@ -58,11 +58,11 @@ void DeviceGpu::initFilterKey() void DeviceGpu::loadBaseDeviceInfo() { // 添加基本信息 - addBaseDeviceInfo(tr("Name"), m_Name); - addBaseDeviceInfo(tr("Vendor"), m_Vendor); - addBaseDeviceInfo(tr("Model"), m_Model); - addBaseDeviceInfo(tr("Version"), m_Version); - addBaseDeviceInfo(tr("Graphics Memory"), m_GraphicsMemory); + addBaseDeviceInfo(("Name"), m_Name); + addBaseDeviceInfo(("Vendor"), m_Vendor); + addBaseDeviceInfo(("Model"), m_Model); + addBaseDeviceInfo(("Version"), m_Version); + addBaseDeviceInfo(("Graphics Memory"), m_GraphicsMemory); } void DeviceGpu::setLshwInfo(const QMap &mapInfo) @@ -315,29 +315,29 @@ void DeviceGpu::loadOtherDeviceInfo() QString type = Common::boardVendorType(); // 添加其他信息,成员变量 - addOtherDeviceInfo(tr("Module Alias"), m_Modalias); - addOtherDeviceInfo(tr("Physical ID"), m_PhysID); - addOtherDeviceInfo(tr("Memory Address"), m_MemAddress); - addOtherDeviceInfo(tr("IO Port"), m_IOPort); - addOtherDeviceInfo(tr("Bus Info"), m_BusInfo); - if (type != "KLVV" && type != "KLVU" && type != "PGUV" && type != "PGUW") { - addOtherDeviceInfo(tr("Maximum Resolution"), m_MaximumResolution); - addOtherDeviceInfo(tr("Minimum Resolution"), m_MinimumResolution); + addOtherDeviceInfo(("Module Alias"), m_Modalias); + addOtherDeviceInfo(("Physical ID"), m_PhysID); + addOtherDeviceInfo(("Memory Address"), m_MemAddress); + addOtherDeviceInfo(("IO Port"), m_IOPort); + addOtherDeviceInfo(("Bus Info"), m_BusInfo); + if (type != Common::specialHString()) { + addOtherDeviceInfo(("Maximum Resolution"), m_MaximumResolution); + addOtherDeviceInfo(("Minimum Resolution"), m_MinimumResolution); } - addOtherDeviceInfo(tr("Current Resolution"), m_CurrentResolution); - addOtherDeviceInfo(tr("Driver"), m_Driver); - addOtherDeviceInfo(tr("Description"), m_Description); -// addOtherDeviceInfo(tr("Clock"), m_Clock); - addOtherDeviceInfo(tr("DP"), m_DisplayPort); - addOtherDeviceInfo(tr("eDP"), m_eDP); - addOtherDeviceInfo(tr("HDMI"), m_HDMI); - addOtherDeviceInfo(tr("VGA"), m_VGA); - addOtherDeviceInfo(tr("DVI"), m_DVI); - addOtherDeviceInfo(tr("DigitalOutput"), m_Digital); // bug-105482添加新接口类型 - addOtherDeviceInfo(tr("Display Output"), m_DisplayOutput); - addOtherDeviceInfo(tr("Capabilities"), m_Capabilities); - addOtherDeviceInfo(tr("IRQ"), m_IRQ); -// addOtherDeviceInfo(tr("Width"), m_Width); + addOtherDeviceInfo(("Current Resolution"), m_CurrentResolution); + addOtherDeviceInfo(("Driver"), m_Driver); + addOtherDeviceInfo(("Description"), m_Description); +// addOtherDeviceInfo(("Clock"), m_Clock); + addOtherDeviceInfo(("DP"), m_DisplayPort); + addOtherDeviceInfo(("eDP"), m_eDP); + addOtherDeviceInfo(("HDMI"), m_HDMI); + addOtherDeviceInfo(("VGA"), m_VGA); + addOtherDeviceInfo(("DVI"), m_DVI); + addOtherDeviceInfo(("DigitalOutput"), m_Digital); // bug-105482添加新接口类型 + addOtherDeviceInfo(("Display Output"), m_DisplayOutput); + addOtherDeviceInfo(("Capabilities"), m_Capabilities); + addOtherDeviceInfo(("IRQ"), m_IRQ); +// addOtherDeviceInfo(("Width"), m_Width); // 将QMap内容转存为QList> mapInfoToList(); diff --git a/deepin-devicemanager/src/DeviceManager/DeviceImage.cpp b/deepin-devicemanager/src/DeviceManager/DeviceImage.cpp index 6ce7aa578..324af8a6e 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceImage.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceImage.cpp @@ -160,24 +160,24 @@ void DeviceImage::initFilterKey() void DeviceImage::loadBaseDeviceInfo() { // 添加基本信息 - addBaseDeviceInfo(tr("Name"), m_Name); - addBaseDeviceInfo(tr("Vendor"), m_Vendor); - addBaseDeviceInfo(tr("Version"), m_Version); - addBaseDeviceInfo(tr("Model"), m_Model); - addBaseDeviceInfo(tr("Bus Info"), m_BusInfo); + addBaseDeviceInfo(("Name"), m_Name); + addBaseDeviceInfo(("Vendor"), m_Vendor); + addBaseDeviceInfo(("Version"), m_Version); + addBaseDeviceInfo(("Model"), m_Model); + addBaseDeviceInfo(("Bus Info"), m_BusInfo); } void DeviceImage::loadOtherDeviceInfo() { // 添加其他信息,成员变量 - addOtherDeviceInfo(tr("Module Alias"), m_Modalias); - addOtherDeviceInfo(tr("Physical ID"), m_PhysID); - addOtherDeviceInfo(tr("Speed"), m_Speed); - addOtherDeviceInfo(tr("Maximum Power"), m_MaximumPower); - addOtherDeviceInfo(tr("Driver"), m_Driver); - addOtherDeviceInfo(tr("Capabilities"), m_Capabilities); + addOtherDeviceInfo(("Module Alias"), m_Modalias); + addOtherDeviceInfo(("Physical ID"), m_PhysID); + addOtherDeviceInfo(("Speed"), m_Speed); + addOtherDeviceInfo(("Maximum Power"), m_MaximumPower); + addOtherDeviceInfo(("Driver"), m_Driver); + addOtherDeviceInfo(("Capabilities"), m_Capabilities); if (m_SerialID != m_UniqueID) - addOtherDeviceInfo(tr("Serial Number"), m_SerialID); + addOtherDeviceInfo(("Serial Number"), m_SerialID); // 将QMap内容转存为QList> mapInfoToList(); diff --git a/deepin-devicemanager/src/DeviceManager/DeviceInfo.cpp b/deepin-devicemanager/src/DeviceManager/DeviceInfo.cpp index 75f00f819..661abbdff 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceInfo.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceInfo.cpp @@ -45,6 +45,17 @@ DeviceBaseInfo::~DeviceBaseInfo() } +const QString DeviceBaseInfo::translateStr(const QString &inStr) +{ + return tr(inStr.toLatin1()); +} + +const QString DeviceBaseInfo::nameTr() +{ + return translateStr(m_Name); +} + + const QList> &DeviceBaseInfo::getOtherAttribs() { // 获取其他设备信息列表 @@ -61,15 +72,52 @@ const QList > &DeviceBaseInfo::getBaseAttribs() return m_LstBaseInfo; } +const QList > &DeviceBaseInfo::getOtherTranslationAttribs() +{ + m_LstOtherInfoTr.clear(); + getOtherAttribs(); + for (const auto &pair : m_LstOtherInfo) { + QString trKey =translateStr(pair.first); + if (trKey.isEmpty()) + m_LstOtherInfoTr.append(qMakePair(pair.first, pair.second)); // 添加到目标列表 + else + m_LstOtherInfoTr.append(qMakePair(trKey, pair.second)); + } + return m_LstOtherInfoTr; +} + +const QList > &DeviceBaseInfo::getBaseTranslationAttribs() +{ + m_LstBaseInfoTr.clear(); + getBaseAttribs(); + for (const auto &pair : m_LstBaseInfo) { + QString trKey = translateStr(pair.first); + if (trKey.isEmpty()) + m_LstBaseInfoTr.append(qMakePair(pair.first, pair.second)); // 添加到目标列表 + else + m_LstBaseInfoTr.append(qMakePair(trKey, pair.second)); + } + return m_LstBaseInfoTr; +} + const QStringList &DeviceBaseInfo::getTableHeader() { + m_TableHeaderTr.clear(); // 获取表头 if (m_TableHeader.size() == 0) { loadTableHeader(); m_TableHeader.append(m_CanEnable ? "yes" : "no"); } - return m_TableHeader; + for (const auto &item : m_TableHeader) { + QString trKey = tr(item.toLatin1()); + if (trKey.isEmpty()) + m_TableHeaderTr.append(item); + else + m_TableHeaderTr.append(trKey); + } + + return m_TableHeaderTr; } const QStringList &DeviceBaseInfo::getTableData() @@ -77,7 +125,15 @@ const QStringList &DeviceBaseInfo::getTableData() // 获取表格数据 m_TableData.clear(); loadTableData(); - return m_TableData; + m_TableDataTr.clear(); + for (const auto &item : m_TableData) { + QString trKey = translateStr(item); + if(trKey.isEmpty()) + m_TableDataTr.append(item); + else + m_TableDataTr.append(trKey); + } + return m_TableDataTr; } QString DeviceBaseInfo::subTitle() @@ -144,8 +200,8 @@ void DeviceBaseInfo::setForcedDisplay(const bool &flag) void DeviceBaseInfo::toHtmlString(QDomDocument &doc) { // 设备信息转为Html - baseInfoToHTML(doc, m_LstBaseInfo); - baseInfoToHTML(doc, m_LstOtherInfo); + baseInfoToHTML(doc, m_LstBaseInfoTr); + baseInfoToHTML(doc, m_LstOtherInfoTr); } void DeviceBaseInfo::baseInfoToHTML(QDomDocument &doc, QList > &infoLst) @@ -201,8 +257,8 @@ void DeviceBaseInfo::subTitleToHTML(QDomDocument &doc) void DeviceBaseInfo::toDocString(Docx::Document &doc) { // 设备信息转为doc - baseInfoToDoc(doc, m_LstBaseInfo); - baseInfoToDoc(doc, m_LstOtherInfo); + baseInfoToDoc(doc, m_LstBaseInfoTr); + baseInfoToDoc(doc, m_LstOtherInfoTr); } void DeviceBaseInfo::baseInfoToDoc(Docx::Document &doc, QList > &infoLst) @@ -224,8 +280,8 @@ void DeviceBaseInfo::baseInfoToDoc(Docx::Document &doc, QList > &infoLst) @@ -251,8 +307,8 @@ void DeviceBaseInfo::baseInfoToXlsx(QXlsx::Document &xlsx, QXlsx::Format &boldFo void DeviceBaseInfo::toTxtString(QTextStream &out) { // 设备信息转为txt - baseInfoToTxt(out, m_LstBaseInfo); - baseInfoToTxt(out, m_LstOtherInfo); + baseInfoToTxt(out, m_LstBaseInfoTr); + baseInfoToTxt(out, m_LstOtherInfoTr); } void DeviceBaseInfo::baseInfoToTxt(QTextStream &out, QList > &infoLst) @@ -280,15 +336,15 @@ void DeviceBaseInfo::tableInfoToTxt(QTextStream &out) getTableData(); // 判断是否有表格内容 - if (m_TableData.size() < 1) + if (m_TableDataTr.size() < 1) return; // 设置占位宽度 - QString text = m_TableData[0]; + QString text = m_TableDataTr[0]; out.setFieldWidth(int(text.size() * 1.5)); out.setFieldAlignment(QTextStream::FieldAlignment::AlignRight); - foreach (auto item, m_TableData) { + foreach (auto item, m_TableDataTr) { out.setFieldWidth(28); out << item; } @@ -303,18 +359,18 @@ void DeviceBaseInfo::tableHeaderToTxt(QTextStream &out) getTableHeader(); // 判断是否有表头 - if (m_TableHeader.size() < 1) + if (m_TableHeaderTr.size() < 1) return; // 设置占位宽度 - QString text = m_TableHeader[0]; + QString text = m_TableHeaderTr[0]; out.setFieldWidth(int(text.size() * 1.5)); out.setFieldAlignment(QTextStream::FieldAlignment::AlignLeft); out << "\n"; - for (int col = 0; col < m_TableHeader.size() - 1; ++col) { + for (int col = 0; col < m_TableHeaderTr.size() - 1; ++col) { out.setFieldWidth(30); - out << m_TableHeader[col]; + out << m_TableHeaderTr[col]; } out.setFieldWidth(0); out << "\n"; @@ -326,11 +382,11 @@ void DeviceBaseInfo::tableInfoToHtml(QFile &html) getTableData(); // 判断是否有表格内容 - if (m_TableData.size() < 1) + if (m_TableDataTr.size() < 1) return; // 写表格内容 - foreach (auto item, m_TableData) { + foreach (auto item, m_TableDataTr) { html.write(QString("" + item + "").toUtf8().data()); } @@ -343,14 +399,14 @@ void DeviceBaseInfo::tableHeaderToHtml(QFile &html) getTableHeader(); // 判断是否有表头 - if (m_TableHeader.size() < 1) + if (m_TableHeaderTr.size() < 1) return; html.write("\n"); // 写表头内容 - for (int col = 0; col < m_TableHeader.size() - 1; ++col) - html.write(QString("" + m_TableHeader[col] + "").toUtf8().data()); + for (int col = 0; col < m_TableHeaderTr.size() - 1; ++col) + html.write(QString("" + m_TableHeaderTr[col] + "").toUtf8().data()); html.write("\n"); } @@ -364,13 +420,13 @@ void DeviceBaseInfo::tableInfoToDoc(Docx::Table *tab, int &row) // 获取表格数据 getTableData(); - if (m_TableData.size() < 1) + if (m_TableDataTr.size() < 1) return; // 添加doc表格 - for (int col = 0; col < m_TableData.size(); ++col) { + for (int col = 0; col < m_TableDataTr.size(); ++col) { auto cel = tab->cell(row, col); - cel->addText(m_TableData[col]); + cel->addText(m_TableDataTr[col]); } } @@ -379,14 +435,14 @@ void DeviceBaseInfo::tableHeaderToDoc(Docx::Table *tab) // 表头保存为doc getTableHeader(); - if (m_TableHeader.size() < 1) + if (m_TableHeaderTr.size() < 1) return; // 添加表头信息 - for (int col = 0; col < m_TableHeader.size() - 1; ++col) { + for (int col = 0; col < m_TableHeaderTr.size() - 1; ++col) { tab->addColumn(); auto cel = tab->cell(0, col); - cel->addText(m_TableHeader[col]); + cel->addText(m_TableHeaderTr[col]); } } @@ -395,13 +451,13 @@ void DeviceBaseInfo::tableInfoToXlsx(QXlsx::Document &xlsx) // 获取表格信息 getTableData(); - if (m_TableData.size() < 1) + if (m_TableDataTr.size() < 1) return; // 添加表格信息 int curRow = DeviceManager::instance()->currentXlsRow(); - for (int col = 0; col < m_TableData.size(); ++col) - xlsx.write(curRow, col + 1, m_TableData[col]); + for (int col = 0; col < m_TableDataTr.size(); ++col) + xlsx.write(curRow, col + 1, m_TableDataTr[col]); } void DeviceBaseInfo::tableHeaderToXlsx(QXlsx::Document &xlsx) @@ -409,16 +465,16 @@ void DeviceBaseInfo::tableHeaderToXlsx(QXlsx::Document &xlsx) // 获取表头 getTableHeader(); - if (m_TableHeader.size() < 1) + if (m_TableHeaderTr.size() < 1) return; // 添加表头信息 int curRow = DeviceManager::instance()->currentXlsRow(); - for (int col = 0; col < m_TableHeader.size() - 1; ++col) { + for (int col = 0; col < m_TableHeaderTr.size() - 1; ++col) { QXlsx::Format boldFont; boldFont.setFontSize(10); boldFont.setFontBold(true); - xlsx.write(curRow, col + 1, m_TableHeader[col], boldFont); + xlsx.write(curRow, col + 1, m_TableHeaderTr[col], boldFont); } } @@ -618,9 +674,9 @@ const QString &DeviceBaseInfo::getModalias() const void DeviceBaseInfo::loadTableHeader() { // 添加表头信息 - m_TableHeader.append(tr("Name")); - m_TableHeader.append(tr("Vendor")); - m_TableHeader.append(tr("Model")); + m_TableHeader.append("Name"); + m_TableHeader.append("Vendor"); + m_TableHeader.append("Model"); } void DeviceBaseInfo::addFilterKey(const QString &key) @@ -634,7 +690,7 @@ void DeviceBaseInfo::getOtherMapInfo(const QMap &mapInfo) // 获取其他设备信息 QMap::const_iterator it = mapInfo.begin(); for (; it != mapInfo.end(); ++it) { - QString k = DApplication::translate("QObject", it.key().trimmed().toStdString().data()); + QString k = it.key(); // 可显示设备属性中存在该属性 if (m_FilterKey.find(k) != m_FilterKey.end()) { @@ -660,6 +716,45 @@ void DeviceBaseInfo::addOtherDeviceInfo(const QString &key, const QString &value m_LstOtherInfo.insert(0, QPair(key, value)); } +const QString DeviceBaseInfo::readDeviceInfoKeyValue(const QString &key) +{ + if (key.isEmpty()) + return QString(""); + // qCInfo(appLog) << __FILE__ << __LINE__ << key << "after translation:"<< kk; + QList > allBaseAttribs = getBaseAttribs(); + for (const QPair& pair : allBaseAttribs) { + if (key == pair.first) + return pair.second; + } + QList > allOtherAttribs = getOtherAttribs(); + for (const QPair& pair : allOtherAttribs) { + if (key == key) + return pair.second; + } + return QString(""); +} + +bool DeviceBaseInfo::setDeviceInfoKeyValue(const QString &key, const QString &value) +{ + if (key.isEmpty() ||value.isEmpty()) + return false; + + for (QPair pair : getBaseAttribs()) { + if (key == pair.first) { + pair.second = value; + return true; + } + } + + for (QPair pair : getOtherAttribs()) { + if (key == pair.first) { + pair.second = value; + return true; + } + } + return false; +} + void DeviceBaseInfo::setAttribute(const QMap &mapInfo, const QString &key, QString &variable, bool overwrite) { // map中存在该属性 diff --git a/deepin-devicemanager/src/DeviceManager/DeviceInfo.h b/deepin-devicemanager/src/DeviceManager/DeviceInfo.h index 1bf565b2b..6bd8fa166 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceInfo.h +++ b/deepin-devicemanager/src/DeviceManager/DeviceInfo.h @@ -43,6 +43,14 @@ class DeviceBaseInfo : public QObject explicit DeviceBaseInfo(QObject *parent = nullptr); virtual ~DeviceBaseInfo(); + const QString translateStr(const QString &inStr); + const QString nameTr(); + /** + * @brief name:获取设备名称 + * @return 设备名称 + */ + virtual const QString &name() const = 0; + /** * @brief getOtherAttribs:获取设备的其它信息 * @return 其他信息组成的map @@ -56,6 +64,19 @@ class DeviceBaseInfo : public QObject */ const QList> &getBaseAttribs(); + /** + * @brief getOtherAttribs:获取设备的其它信息 + * @return 其他信息组成的map + */ + //const QMap &getOtherAttribs()const; + const QList> &getOtherTranslationAttribs(); + + /** + * @brief getBaseAttribs::获取基本设备信息 + * @return 基本信息组成的list + */ + const QList> &getBaseTranslationAttribs(); + /** * @brief getTableHeader : 用于存放表格的头部 * @return : 用于存放表格的头部 @@ -80,12 +101,6 @@ class DeviceBaseInfo : public QObject */ virtual const QString getOverviewInfo(); - /** - * @brief name:获取设备名称 - * @return 设备名称 - */ - virtual const QString &name() const = 0; - /** * @brief vendor:获取设备制造商 * @return 设备制造商 @@ -221,6 +236,20 @@ class DeviceBaseInfo : public QObject */ const QString getDriverVersion(); + /** + * @brief readDeviceInfoKeyValue:读取key信息 + * @param key:属性名称 + * @return :value属性值 + */ + const QString readDeviceInfoKeyValue(const QString &key); + + /** + * @brief readDeviceInfoKeyValue:设置key信息 + * @param key:属性名称 + * @return :value属性值 + */ + bool setDeviceInfoKeyValue(const QString &key, const QString &value); + /** * @brief isValid:判断属性值是否有效 * @param value:属性值 @@ -480,7 +509,11 @@ class DeviceBaseInfo : public QObject QString m_HwinfoToLshw; //> m_LstBaseInfo; //> m_LstOtherInfo; //> m_LstBaseInfoTr; //> m_LstOtherInfoTr; // m_FilterKey; // &mapInfo) getOtherMapInfo(mapInfo); } -void DeviceInput::setKLUInfoFromHwinfo(const QMap &mapInfo) -{ - // 设置设备基本属性 - setAttribute(mapInfo, "Device", m_Name); - setAttribute(mapInfo, "Vendor", m_Vendor); - setAttribute(mapInfo, "Model", m_Model); - setAttribute(mapInfo, "Revision", m_Version); - if (mapInfo.find("Hotplug") != mapInfo.end()) - setAttribute(mapInfo, "Hotplug", m_Interface); - else - m_Interface = "PS/2"; - - // 上面的方法不适合蓝牙键盘的获取方法 - if (mapInfo.find("Model")->contains("Bluetooth", Qt::CaseInsensitive) || mapInfo.find("Device")->contains("Bluetooth", Qt::CaseInsensitive)) - m_Interface = "Bluetooth"; - - setAttribute(mapInfo, "SysFS BusID", m_BusInfo); - setAttribute(mapInfo, "Hardware Class", m_Description); - setAttribute(mapInfo, "Driver", m_Driver); - setAttribute(mapInfo, "Speed", m_Speed); - - // 获取映射到 lshw设备信息的 关键字 - //1-2:1.0 - QStringList words = mapInfo["SysFS BusID"].split(":"); - if (words.size() == 2) { - QStringList chs = words[0].split("-"); - if (chs.size() == 2) - m_KeyToLshw = QString("usb@%1:%2").arg(chs[0]).arg(chs[1]); - } - - // 由bluetoothctl paired-devices设置设备接口 - setInfoFromBluetoothctl(); - - // 获取其他设备信息 - getOtherMapInfo(mapInfo); -} - void DeviceInput::setInfoFromBluetoothctl() { // 判断该设备信息是否存在于Bluetoothctl中 @@ -454,38 +417,38 @@ bool DeviceInput::bluetoothIsConnected() void DeviceInput::initFilterKey() { // 添加可显示的设备信息 - addFilterKey(QObject::tr("Uniq")); - addFilterKey(QObject::tr("PROP")); - addFilterKey(QObject::tr("EV")); - addFilterKey(QObject::tr("KEY")); - addFilterKey(QObject::tr("MSC")); - addFilterKey(QObject::tr("Device File")); - addFilterKey(QObject::tr("Hardware Class")); + addFilterKey("Uniq"); + addFilterKey("PROP"); + addFilterKey("EV"); + addFilterKey("KEY"); + addFilterKey("MSC"); + addFilterKey("Device File"); + addFilterKey("Hardware Class"); - // addFilterKey(QObject::tr("physical id")); + // addFilterKey("physical id"); } void DeviceInput::loadBaseDeviceInfo() { // 添加基本信息 - addBaseDeviceInfo(tr("Name"), m_Name); - addBaseDeviceInfo(tr("Vendor"), m_Vendor); - addBaseDeviceInfo(tr("Model"), m_Model); - addBaseDeviceInfo(tr("Interface"), m_Interface); - addBaseDeviceInfo(tr("Bus Info"), m_BusInfo); + addBaseDeviceInfo(("Name"), m_Name); + addBaseDeviceInfo(("Vendor"), m_Vendor); + addBaseDeviceInfo(("Model"), m_Model); + addBaseDeviceInfo(("Interface"), m_Interface); + addBaseDeviceInfo(("Bus Info"), m_BusInfo); } void DeviceInput::loadOtherDeviceInfo() { // 添加其他信息,成员变量 - addOtherDeviceInfo(tr("Module Alias"), m_Modalias); - addOtherDeviceInfo(tr("Physical ID"), m_PhysID); - addOtherDeviceInfo(tr("Speed"), m_Speed); - addOtherDeviceInfo(tr("Maximum Current"), m_MaximumPower); // 1050需求将最大功率改为最大电流 - addOtherDeviceInfo(tr("Driver"), m_Driver); - addOtherDeviceInfo(tr("Capabilities"), m_Capabilities); - addOtherDeviceInfo(tr("Version"), m_Version); + addOtherDeviceInfo(("Module Alias"), m_Modalias); + addOtherDeviceInfo(("Physical ID"), m_PhysID); + addOtherDeviceInfo(("Speed"), m_Speed); + addOtherDeviceInfo(("Maximum Current"), m_MaximumPower); // 1050需求将最大功率改为最大电流 + addOtherDeviceInfo(("Driver"), m_Driver); + addOtherDeviceInfo(("Capabilities"), m_Capabilities); + addOtherDeviceInfo(("Version"), m_Version); // 将QMap内容转存为QList> mapInfoToList(); diff --git a/deepin-devicemanager/src/DeviceManager/DeviceInput.h b/deepin-devicemanager/src/DeviceManager/DeviceInput.h index 1120f5cd1..2f11d2e74 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceInput.h +++ b/deepin-devicemanager/src/DeviceManager/DeviceInput.h @@ -40,12 +40,6 @@ class DeviceInput : public DeviceBaseInfo */ void setInfoFromHwinfo(const QMap &mapInfo); - /** - * @brief setKLUInfoFromHwinfo:特殊处理KLU设备,设置由hwinfo --keyboard 命令获取的设备信息 - * @param mapInfo由hwinfo获取的信息map - */ - void setKLUInfoFromHwinfo(const QMap &mapInfo); - /** * @brief name:获取名称属性值 * @return QString 名称属性值 diff --git a/deepin-devicemanager/src/DeviceManager/DeviceManager.cpp b/deepin-devicemanager/src/DeviceManager/DeviceManager.cpp index db0766823..f3f43b333 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceManager.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceManager.cpp @@ -385,7 +385,7 @@ DeviceBaseInfo *DeviceManager::createDevice(DeviceType deviceType) return vTemp; } -TomlFixMethod DeviceManager::tomlDeviceSet(DeviceType deviceType, DeviceBaseInfo *device, const QMap &mapInfo) +TomlFixMethod DeviceManager::tomlDeviceMapSet(DeviceType deviceType, DeviceBaseInfo *device, const QMap &mapInfo) { if (!device) { return TOML_None; @@ -472,6 +472,92 @@ TomlFixMethod DeviceManager::tomlDeviceSet(DeviceType deviceType, DeviceBaseInf return ret; } +QString DeviceManager::tomlDeviceReadKeyValue(DeviceType deviceType, DeviceBaseInfo *device, const QString &key) +{ + if (!device) + return QString(""); + + TomlFixMethod ret = TOML_None; + switch (deviceType) { + case DT_Null: + break; + case DT_Computer: { + DeviceComputer *tomldevice = dynamic_cast(device); + return tomldevice->readDeviceInfoKeyValue(key); + } break; + case DT_Cpu: { + DeviceCpu *tomldevice = dynamic_cast(device); + return tomldevice->readDeviceInfoKeyValue(key); + } break; + case DT_Bios: { + DeviceBios *tomldevice = dynamic_cast(device); + return tomldevice->readDeviceInfoKeyValue(key); + } break; + case DT_Memory: { + DeviceMemory *tomldevice = dynamic_cast(device); + return tomldevice->readDeviceInfoKeyValue(key); + } break; + case DT_Storage: { + DeviceStorage *tomldevice = dynamic_cast(device); + return tomldevice->readDeviceInfoKeyValue(key); + } break; + case DT_Gpu: { + DeviceGpu *tomldevice = dynamic_cast(device); + return tomldevice->readDeviceInfoKeyValue(key); + } break; + case DT_Monitor: { + DeviceMonitor *tomldevice = dynamic_cast(device); + return tomldevice->readDeviceInfoKeyValue(key); + } break; + case DT_Network: { + DeviceNetwork *tomldevice = dynamic_cast(device); + return tomldevice->readDeviceInfoKeyValue(key); + } break; + case DT_Audio: { + DeviceAudio *tomldevice = dynamic_cast(device); + return tomldevice->readDeviceInfoKeyValue(key); + } break; + case DT_Bluetoorh: { + DeviceBluetooth *tomldevice = dynamic_cast(device); + return tomldevice->readDeviceInfoKeyValue(key); + } break; + case DT_Keyboard: { + DeviceInput *tomldevice = dynamic_cast(device); + return tomldevice->readDeviceInfoKeyValue(key); + } break; + case DT_Mouse: { + DeviceInput *tomldevice = dynamic_cast(device); + return tomldevice->readDeviceInfoKeyValue(key); + } break; + case DT_Print: { + DevicePrint *tomldevice = dynamic_cast(device); + return tomldevice->readDeviceInfoKeyValue(key); + } break; + case DT_Image: { + DeviceImage *tomldevice = dynamic_cast(device); + return tomldevice->readDeviceInfoKeyValue(key); + } break; + case DT_Cdrom: { + DeviceCdrom *tomldevice = dynamic_cast(device); + return tomldevice->readDeviceInfoKeyValue(key); + } break; + case DT_Others: { + DeviceOthers *tomldevice = dynamic_cast(device); + return tomldevice->readDeviceInfoKeyValue(key); + } break; + case DT_OtherPCI: { + DeviceOtherPCI *tomldevice = dynamic_cast(device); + return tomldevice->readDeviceInfoKeyValue(key); + } break; + case DT_Power: { + DevicePower *tomldevice = dynamic_cast(device); + return tomldevice->readDeviceInfoKeyValue(key); + } break; + default: { } break; + } + return QString(""); +} + void DeviceManager::tomlDeviceSet(DeviceType deviceType) { @@ -498,7 +584,7 @@ void DeviceManager::tomlDeviceSet(DeviceType deviceType) } if (isSameOne) { //存在 就合并信息 setInfoFromTomlOneByOne(const QMap &mapInfo); fixSameOne = true; //标记为该项信息有用过 , - if (TOML_Del == tomlDeviceSet(deviceType, device, tomlMapLst[j])) { + if (TOML_Del == tomlDeviceMapSet(deviceType, device, tomlMapLst[j])) { tomlDeviceDel(deviceType, device); //toml 去掉该设备 delete (device); } @@ -507,7 +593,7 @@ void DeviceManager::tomlDeviceSet(DeviceType deviceType) if ((deviceType != DT_Bios) && (deviceType != DT_Computer) && !fixSameOne) { fixSameOne = true; //标记为该项信息有用过 ,则不再增加了 DeviceBaseInfo *device = createDevice(deviceType); - tomlDeviceSet(deviceType, device, tomlMapLst[j]); + tomlDeviceMapSet(deviceType, device, tomlMapLst[j]); tomlDeviceAdd(deviceType, device); //不存在 就加 } } //end of for (int j = 0;... @@ -784,23 +870,6 @@ bool DeviceManager::setStorageDeviceMediaType(const QString &name, const QString return false; } -bool DeviceManager::setKLUStorageDeviceMediaType(const QString &name, const QString &value) -{ - // 设置KLU机器存储设备介质类型 - QList::iterator it = m_ListDeviceStorage.begin(); - for (; it != m_ListDeviceStorage.end(); ++it) { - DeviceStorage *device = dynamic_cast(*it); - - if (!device) - continue; - - // 设置KLU介质类型 - if (device->setKLUMediaType(name, value)) - return true; - } - return false; -} - void DeviceManager::addGpuDevice(DeviceGpu *const device) { // 添加显示适配器 diff --git a/deepin-devicemanager/src/DeviceManager/DeviceManager.h b/deepin-devicemanager/src/DeviceManager/DeviceManager.h index 8bfc16d7e..0b2ebb7d3 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceManager.h +++ b/deepin-devicemanager/src/DeviceManager/DeviceManager.h @@ -103,10 +103,12 @@ class DeviceManager : public QObject */ QList convertDeviceList(DeviceType deviceType); QString convertDeviceTomlClassName(DeviceType deviceType); - TomlFixMethod tomlDeviceSet(DeviceType deviceType, DeviceBaseInfo *device, const QMap &mapInfo); + TomlFixMethod tomlDeviceMapSet(DeviceType deviceType, DeviceBaseInfo *device, const QMap &mapInfo); void tomlDeviceSet(DeviceType deviceType); void tomlDeviceDel(DeviceType deviceType, DeviceBaseInfo *const device); void tomlDeviceAdd(DeviceType deviceType, DeviceBaseInfo *const device); + QString tomlDeviceReadKeyValue(DeviceType deviceType, DeviceBaseInfo *device, const QString &key); + /** * @brief * toml 方案内容定义: @@ -196,14 +198,6 @@ class DeviceManager : public QObject */ bool setStorageDeviceMediaType(const QString &name, const QString &value); - /** - * @brief setKLUStorageDeviceMediaType:KLU机器设置存储设备介质类型 - * @param name:逻辑名称 - * @param value:存储设备介质类型信息 - * @return 布尔值:true-设置成功;false-设置失败 - */ - bool setKLUStorageDeviceMediaType(const QString &name, const QString &value); - /** * @brief setStorageInfoFromSmartctl:设置由smartctl获取的存储设备信息 * @param name:逻辑名称 diff --git a/deepin-devicemanager/src/DeviceManager/DeviceMemory.cpp b/deepin-devicemanager/src/DeviceManager/DeviceMemory.cpp index 64c320096..94bcfab53 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceMemory.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceMemory.cpp @@ -106,39 +106,39 @@ bool DeviceMemory::setInfoFromDmidecode(const QMap &mapInfo) void DeviceMemory::initFilterKey() { // 初始化可显示属性 - addFilterKey(QObject::tr("Array Handle")); // 数组程序 - addFilterKey(QObject::tr("Error Information Handle")); //错误信息程序 - addFilterKey(QObject::tr("Form Factor")); // 尺寸型号 - addFilterKey(QObject::tr("Set")); // 设置 - addFilterKey(QObject::tr("Bank Locator")); // 内存通道 - addFilterKey(QObject::tr("Type Detail")); // 类型详细信息 - addFilterKey(QObject::tr("Asset Tag")); // 资产标签 - addFilterKey(QObject::tr("Part Number")); - addFilterKey(QObject::tr("Rank")); - addFilterKey(QObject::tr("Memory Technology")); // 内存技术 - addFilterKey(QObject::tr("Memory Operating Mode Capability")); // 内存操作模式 - addFilterKey(QObject::tr("Firmware Version")); //固件版本 - addFilterKey(QObject::tr("Module Manufacturer ID")); - addFilterKey(QObject::tr("Module Product ID")); - addFilterKey(QObject::tr("Memory Subsystem Controller Manufacturer ID")); - addFilterKey(QObject::tr("Memory Subsystem Controller Product ID")); - addFilterKey(QObject::tr("Non-Volatile Size")); // 不易丢失大小 - addFilterKey(QObject::tr("Volatile Size")); // 易丢失大小 - addFilterKey(QObject::tr("Cache Size")); // 缓存大小 - addFilterKey(QObject::tr("Logical Size")); // 逻辑大小 + addFilterKey("Array Handle"); // 数组程序-2 + addFilterKey("Error Information Handle"); //错误信息程序-2 + addFilterKey("Form Factor"); // 尺寸型号-2 + addFilterKey("Set"); // 设置-2 + addFilterKey("Bank Locator"); // 内存通道-2 + addFilterKey("Type Detail"); // 类型详细信息-2 + addFilterKey("Asset Tag"); // 资产标签-2 + addFilterKey("Part Number"); + addFilterKey("Rank"); + addFilterKey("Memory Technology"); // 内存技术-2 + addFilterKey("Memory Operating Mode Capability"); // 内存操作模式-2 + addFilterKey("Firmware Version"); //固件版本-2 + addFilterKey("Module Manufacturer ID"); + addFilterKey("Module Product ID"); + addFilterKey("Memory Subsystem Controller Manufacturer ID"); + addFilterKey("Memory Subsystem Controller Product ID"); + addFilterKey("Non-Volatile Size"); // 不易丢失大小-2 + addFilterKey("Volatile Size"); // 易丢失大小-2 + addFilterKey("Cache Size"); // 缓存大小-2 + addFilterKey("Logical Size"); // 逻辑大小-2 } void DeviceMemory::loadBaseDeviceInfo() { // 添加基本信息 - addBaseDeviceInfo(tr("Name"), m_Name); - addBaseDeviceInfo(tr("Vendor"), m_Vendor); - addBaseDeviceInfo(tr("Size"), m_Size); - addBaseDeviceInfo(tr("Type"), m_Type); - addBaseDeviceInfo(tr("Speed"), m_Speed); - addBaseDeviceInfo(tr("Total Width"), m_TotalBandwidth); - addBaseDeviceInfo(tr("Locator"), m_Locator); - addBaseDeviceInfo(tr("Serial Number"), m_SerialNumber); + addBaseDeviceInfo(("Name"), m_Name); + addBaseDeviceInfo(("Vendor"), m_Vendor); + addBaseDeviceInfo(("Size"), m_Size); + addBaseDeviceInfo(("Type"), m_Type); + addBaseDeviceInfo(("Speed"), m_Speed); + addBaseDeviceInfo(("Total Width"), m_TotalBandwidth); + addBaseDeviceInfo(("Locator"), m_Locator); + addBaseDeviceInfo(("Serial Number"), m_SerialNumber); } void DeviceMemory::loadOtherDeviceInfo() @@ -146,14 +146,14 @@ void DeviceMemory::loadOtherDeviceInfo() // 倒序,头插,保证原来的顺序 // 添加其他信息,成员变量 if (Common::boardVendorType().isEmpty()) { - addOtherDeviceInfo(tr("Configured Voltage"), m_ConfiguredVoltage); - addOtherDeviceInfo(tr("Maximum Voltage"), m_MaximumVoltage); - addOtherDeviceInfo(tr("Minimum Voltage"), m_MinimumVoltage); - addOtherDeviceInfo(tr("Configured Speed"), m_ConfiguredSpeed); + addOtherDeviceInfo(("Configured Voltage"), m_ConfiguredVoltage); + addOtherDeviceInfo(("Maximum Voltage"), m_MaximumVoltage); + addOtherDeviceInfo(("Minimum Voltage"), m_MinimumVoltage); + addOtherDeviceInfo(("Configured Speed"), m_ConfiguredSpeed); } else { - addOtherDeviceInfo(tr("Configured Speed"), m_ConfiguredSpeed); + addOtherDeviceInfo(("Configured Speed"), m_ConfiguredSpeed); } - addOtherDeviceInfo(tr("Data Width"), m_DataBandwidth); + addOtherDeviceInfo(("Data Width"), m_DataBandwidth); // 将QMap内容转存为QList> mapInfoToList(); @@ -162,11 +162,11 @@ void DeviceMemory::loadOtherDeviceInfo() void DeviceMemory::loadTableHeader() { // 加载表头 - m_TableHeader.append(tr("Name")); - m_TableHeader.append(tr("Vendor")); - m_TableHeader.append(tr("Type")); - m_TableHeader.append(tr("Speed")); - m_TableHeader.append(tr("Size")); + m_TableHeader.append("Name"); + m_TableHeader.append("Vendor"); + m_TableHeader.append("Type"); + m_TableHeader.append("Speed"); + m_TableHeader.append("Size"); } void DeviceMemory::loadTableData() diff --git a/deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp b/deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp index 370b964a6..c84ddf2c1 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp @@ -139,23 +139,12 @@ TomlFixMethod DeviceMonitor::setInfoFromTomlOneByOne(const QMap &mapInfo) -{ - setAttribute(mapInfo, "Name", m_Name); - setAttribute(mapInfo, "Vendor", m_Vendor); - setAttribute(mapInfo, "CurResolution", m_CurrentResolution); - setAttribute(mapInfo, "SupportResolution", m_SupportResolution); - setAttribute(mapInfo, "Size", m_ScreenSize); - setAttribute(mapInfo, "Date", m_ProductionWeek); - // 加载其他属性 - //loadOtherDeviceInfo(mapInfo); -} - void DeviceMonitor::setInfoFromEdid(const QMap &mapInfo) { m_Name = "Monitor " + mapInfo["Vendor"]; @@ -264,32 +253,32 @@ const QString DeviceMonitor::getOverviewInfo() void DeviceMonitor::initFilterKey() { - addFilterKey(QObject::tr("Date")); + addFilterKey("Date"); } void DeviceMonitor::loadBaseDeviceInfo() { // 添加基本信息 - addBaseDeviceInfo(tr("Name"), m_Name); - addBaseDeviceInfo(tr("Vendor"), m_Vendor); - addBaseDeviceInfo(tr("Type"), m_Model); - addBaseDeviceInfo(tr("Display Input"), m_DisplayInput); - addBaseDeviceInfo(tr("Interface Type"), m_Interface); + addBaseDeviceInfo(("Name"), m_Name); + addBaseDeviceInfo(("Vendor"), m_Vendor); + addBaseDeviceInfo(("Type"), m_Model); + addBaseDeviceInfo(("Display Input"), m_DisplayInput); + addBaseDeviceInfo(("Interface Type"), m_Interface); } void DeviceMonitor::loadOtherDeviceInfo() { // 添加其他信息,成员变量 - addOtherDeviceInfo(tr("Support Resolution"), m_SupportResolution); + addOtherDeviceInfo(("Refresh Rate"), m_RefreshRate); + addOtherDeviceInfo(("Support Resolution"), m_SupportResolution); if (m_CurrentResolution != "@Hz") { - addOtherDeviceInfo(tr("Current Resolution"), m_CurrentResolution); - addOtherDeviceInfo(tr("Display Ratio"), m_AspectRatio); + addOtherDeviceInfo(("Current Resolution"), m_CurrentResolution); + addOtherDeviceInfo(("Display Ratio"), m_AspectRatio); } - addOtherDeviceInfo(tr("Primary Monitor"), m_MainScreen); - addOtherDeviceInfo(tr("Size"), m_ScreenSize); - addOtherDeviceInfo(tr("Serial Number"), m_SerialNumber); -// addOtherDeviceInfo(tr("Product Date"), m_ProductionWeek); - + addOtherDeviceInfo(("Primary Monitor"), m_MainScreen); + addOtherDeviceInfo(("Size"), m_ScreenSize); + addOtherDeviceInfo(("Serial Number"), m_SerialNumber); +// addOtherDeviceInfo(("Product Date"), m_ProductionWeek); mapInfoToList(); } @@ -422,6 +411,6 @@ bool DeviceMonitor::caculateScreenSize(const QString &edid) return true; double inch = std::sqrt(height * height + width * width) / 2.54 / 10; - m_ScreenSize = QString("%1 %2(%3mm X %4mm)").arg(QString::number(inch, '0', 1)).arg(QObject::tr("inch")).arg(width).arg(height); + m_ScreenSize = QString("%1 %2(%3mm X %4mm)").arg(QString::number(inch, '0', 1)).arg(("inch")).arg(width).arg(height); return true; } diff --git a/deepin-devicemanager/src/DeviceManager/DeviceMonitor.h b/deepin-devicemanager/src/DeviceManager/DeviceMonitor.h index e2261173c..8b37d2d31 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceMonitor.h +++ b/deepin-devicemanager/src/DeviceManager/DeviceMonitor.h @@ -59,12 +59,6 @@ class DeviceMonitor : public DeviceBaseInfo */ QString parseMonitorSize(const QString &sizeDescription, double &inch, QSize &retSize); - /**@brief:华为KLU项目里面的显示屏信息是写死的*/ - /** - * @brief setInfoFromSelfDefine:设置华为KLU项目里面的显示屏信息部分为固定的值 - * @param mapInfo:固定值信息map - */ - void setInfoFromSelfDefine(const QMap &mapInfo); /**@brief:华为PanGuV项目里面的显示屏信息是从edid里面获取的*/ /** @@ -200,6 +194,7 @@ class DeviceMonitor : public DeviceBaseInfo QString m_SerialNumber; // &mapInfo) setAttribute(mapInfo, "ip", m_Ip); setAttribute(mapInfo, "size", m_Speed); setAttribute(mapInfo, "capacity", m_Capacity); - setAttribute(mapInfo, "latency", m_Latency); + setAttribute(mapInfo, "Latency", m_Latency); setAttribute(mapInfo, "multicast", m_Multicast); if (driverIsKernelIn(m_DriverModules) || driverIsKernelIn(m_Driver)) { m_CanUninstall = false; @@ -188,7 +188,7 @@ bool DeviceNetwork::setInfoFromHwinfo(const QMap &mapInfo) bool DeviceNetwork::setInfoFromWifiInfo(const QMap &mapInfo) { // 机器自身蓝牙 - if (m_Name.contains("Huawei", Qt::CaseInsensitive)) { + if (m_Name.contains(Common::specialHString(), Qt::CaseInsensitive)) { setAttribute(mapInfo, "Chip Type", m_Name); setAttribute(mapInfo, "Vendor", m_Vendor); setAttribute(mapInfo, "Type", m_Model); @@ -284,45 +284,45 @@ QString DeviceNetwork::hwAddress() void DeviceNetwork::initFilterKey() { // 初始化可显示属性 - addFilterKey(QObject::tr("ioport")); - addFilterKey(QObject::tr("network")); + addFilterKey("ioport"); + addFilterKey("network"); } void DeviceNetwork::loadBaseDeviceInfo() { // 添加基本信息 - addBaseDeviceInfo(tr("Name"), m_Name); - addBaseDeviceInfo(tr("Vendor"), m_Vendor); - addBaseDeviceInfo(tr("Type"), m_Model); - addBaseDeviceInfo(tr("Version"), m_Version); - addBaseDeviceInfo(tr("Bus Info"), m_BusInfo); - addBaseDeviceInfo(tr("Capabilities"), m_Capabilities); - addBaseDeviceInfo(tr("Driver"), m_Driver); - addBaseDeviceInfo(tr("Driver Version"), m_DriverVersion); + addBaseDeviceInfo(("Name"), m_Name); + addBaseDeviceInfo(("Vendor"), m_Vendor); + addBaseDeviceInfo(("Type"), m_Model); + addBaseDeviceInfo(("Version"), m_Version); + addBaseDeviceInfo(("Bus Info"), m_BusInfo); + addBaseDeviceInfo(("Capabilities"), m_Capabilities); + addBaseDeviceInfo(("Driver"), m_Driver); + addBaseDeviceInfo(("Driver Version"), m_DriverVersion); } void DeviceNetwork::loadOtherDeviceInfo() { // 添加其他信息,成员变量 - addOtherDeviceInfo(tr("Module Alias"), m_Modalias); - addOtherDeviceInfo(tr("Physical ID"), m_PhysID); - addOtherDeviceInfo(tr("Maximum Rate"), m_Capacity); // 1050需求 容量改为最大速率 - addOtherDeviceInfo(tr("Negotiation Rate"), m_Speed); // 1050需求 速度改为协商速率 - addOtherDeviceInfo(tr("Port"), m_Port); - addOtherDeviceInfo(tr("Multicast"), m_Multicast); - addOtherDeviceInfo(tr("Link"), m_Link); - addOtherDeviceInfo(tr("Latency"), m_Latency); - addOtherDeviceInfo(tr("IP"), m_Ip); - addOtherDeviceInfo(tr("Firmware"), m_Firmware); - addOtherDeviceInfo(tr("Duplex"), m_Duplex); - addOtherDeviceInfo(tr("Broadcast"), m_Broadcast); - addOtherDeviceInfo(tr("Auto Negotiation"), m_Autonegotiation); -// addOtherDeviceInfo(tr("Clock"), m_Clock); -// addOtherDeviceInfo(tr("Width"), m_Width); - addOtherDeviceInfo(tr("Memory Address"), m_Memory); // 1050需求 内存改为内存地址 - addOtherDeviceInfo(tr("IRQ"), m_Irq); - addOtherDeviceInfo(tr("MAC Address"), m_MACAddress); - addOtherDeviceInfo(tr("Logical Name"), m_LogicalName); + addOtherDeviceInfo(("Module Alias"), m_Modalias); + addOtherDeviceInfo(("Physical ID"), m_PhysID); + addOtherDeviceInfo(("Maximum Rate"), m_Capacity); // 1050需求 容量改为最大速率 + addOtherDeviceInfo(("Negotiation Rate"), m_Speed); // 1050需求 速度改为协商速率 + addOtherDeviceInfo(("Port"), m_Port); + addOtherDeviceInfo(("Multicast"), m_Multicast); + addOtherDeviceInfo(("Link"), m_Link); + addOtherDeviceInfo(("Latency"), m_Latency); + addOtherDeviceInfo(("IP"), m_Ip); + addOtherDeviceInfo(("Firmware"), m_Firmware); + addOtherDeviceInfo(("Duplex"), m_Duplex); + addOtherDeviceInfo(("Broadcast"), m_Broadcast); + addOtherDeviceInfo(("Auto Negotiation"), m_Autonegotiation); +// addOtherDeviceInfo(("Clock"), m_Clock); +// addOtherDeviceInfo(("Width"), m_Width); + addOtherDeviceInfo(("Memory Address"), m_Memory); // 1050需求 内存改为内存地址 + addOtherDeviceInfo(("IRQ"), m_Irq); + addOtherDeviceInfo(("MAC Address"), m_MACAddress); + addOtherDeviceInfo(("Logical Name"), m_LogicalName); // 将QMap内容转存为QList> mapInfoToList(); @@ -330,9 +330,9 @@ void DeviceNetwork::loadOtherDeviceInfo() void DeviceNetwork::loadTableHeader() { - m_TableHeader.append(tr("Name")); - m_TableHeader.append(tr("Vendor")); - m_TableHeader.append(tr("Type")); + m_TableHeader.append("Name"); + m_TableHeader.append("Vendor"); + m_TableHeader.append("Type"); } void DeviceNetwork::loadTableData() diff --git a/deepin-devicemanager/src/DeviceManager/DeviceOtherPCI.cpp b/deepin-devicemanager/src/DeviceManager/DeviceOtherPCI.cpp index 519dfd72d..c50d4a247 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceOtherPCI.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceOtherPCI.cpp @@ -71,24 +71,24 @@ void DeviceOtherPCI::initFilterKey() void DeviceOtherPCI::loadBaseDeviceInfo() { // 添加基本信息 - addBaseDeviceInfo(tr("Name"), m_Name.isEmpty() ? m_Vendor + m_Model : m_Name); - addBaseDeviceInfo(tr("Vendor"), m_Vendor); - addBaseDeviceInfo(tr("Model"), m_Model); - addBaseDeviceInfo(tr("Bus Info"), m_BusInfo); - addBaseDeviceInfo(tr("Version"), m_Version); + addBaseDeviceInfo(("Name"), m_Name.isEmpty() ? m_Vendor + m_Model : m_Name); + addBaseDeviceInfo(("Vendor"), m_Vendor); + addBaseDeviceInfo(("Model"), m_Model); + addBaseDeviceInfo(("Bus Info"), m_BusInfo); + addBaseDeviceInfo(("Version"), m_Version); } void DeviceOtherPCI::loadOtherDeviceInfo() { // 添加其他信息,成员变量 - addOtherDeviceInfo(tr("Input/Output"), m_InputOutput); - addOtherDeviceInfo(tr("Memory"), m_Memory); - addOtherDeviceInfo(tr("IRQ"), m_Irq); - addOtherDeviceInfo(tr("Latency"), m_Latency); -// addOtherDeviceInfo(tr("Clock"), m_Clock); -// addOtherDeviceInfo(tr("Width"), m_Width); - addOtherDeviceInfo(tr("Driver"), m_Driver); - addOtherDeviceInfo(tr("Capabilities"), m_Version); + addOtherDeviceInfo(("Input/Output"), m_InputOutput); + addOtherDeviceInfo(("Memory"), m_Memory); + addOtherDeviceInfo(("IRQ"), m_Irq); + addOtherDeviceInfo(("Latency"), m_Latency); +// addOtherDeviceInfo(("Clock"), m_Clock); +// addOtherDeviceInfo(("Width"), m_Width); + addOtherDeviceInfo(("Driver"), m_Driver); + addOtherDeviceInfo(("Capabilities"), m_Version); // 将QMap内容转存为QList> mapInfoToList(); diff --git a/deepin-devicemanager/src/DeviceManager/DeviceOthers.cpp b/deepin-devicemanager/src/DeviceManager/DeviceOthers.cpp index b800edd81..bf5956366 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceOthers.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceOthers.cpp @@ -174,28 +174,28 @@ bool DeviceOthers::available() void DeviceOthers::initFilterKey() { - addFilterKey(QObject::tr("Device File")); - addFilterKey(QObject::tr("Hardware Class")); + addFilterKey("Device File"); + addFilterKey("Hardware Class"); } void DeviceOthers::loadBaseDeviceInfo() { // 添加基本信息 - addBaseDeviceInfo(tr("Name"), m_Name); - addBaseDeviceInfo(tr("Vendor"), m_Vendor); - addBaseDeviceInfo(tr("Model"), m_Model); - addBaseDeviceInfo(tr("Version"), m_Version); - addBaseDeviceInfo(tr("Bus Info"), m_BusInfo); - addBaseDeviceInfo(tr("Capabilities"), m_Capabilities); - addBaseDeviceInfo(tr("Driver"), m_Driver); - addBaseDeviceInfo(tr("Maximum Power"), m_MaximumPower); - addBaseDeviceInfo(tr("Speed"), m_Speed); + addBaseDeviceInfo(("Name"), m_Name); + addBaseDeviceInfo(("Vendor"), m_Vendor); + addBaseDeviceInfo(("Model"), m_Model); + addBaseDeviceInfo(("Version"), m_Version); + addBaseDeviceInfo(("Bus Info"), m_BusInfo); + addBaseDeviceInfo(("Capabilities"), m_Capabilities); + addBaseDeviceInfo(("Driver"), m_Driver); + addBaseDeviceInfo(("Maximum Power"), m_MaximumPower); + addBaseDeviceInfo(("Speed"), m_Speed); } void DeviceOthers::loadOtherDeviceInfo() { if (m_SerialID != m_UniqueID) - addOtherDeviceInfo(tr("Serial Number"), m_SerialID); + addOtherDeviceInfo(("Serial Number"), m_SerialID); mapInfoToList(); } diff --git a/deepin-devicemanager/src/DeviceManager/DevicePower.cpp b/deepin-devicemanager/src/DeviceManager/DevicePower.cpp index 781333202..477bacf66 100644 --- a/deepin-devicemanager/src/DeviceManager/DevicePower.cpp +++ b/deepin-devicemanager/src/DeviceManager/DevicePower.cpp @@ -4,6 +4,7 @@ // 项目自身文件 #include "DevicePower.h" +#include "commonfunction.h" // Qt库文件 #include @@ -82,8 +83,6 @@ bool DevicePower::setInfoFromUpower(const QMap &mapInfo) setAttribute(mapInfo, "capacity", m_Capacity); setAttribute(mapInfo, "voltage", m_Voltage); setAttribute(mapInfo, "", m_Slot); -// setAttribute(mapInfo, "capacity", m_DesignCapacity); -// setAttribute(mapInfo, "voltage", m_DesignVoltage); setAttribute(mapInfo, "", m_SBDSChemistry); setAttribute(mapInfo, "", m_SBDSManufactureDate); setAttribute(mapInfo, "", m_SBDSSerialNumber); @@ -146,51 +145,55 @@ const QString DevicePower::getOverviewInfo() void DevicePower::initFilterKey() { // 初始化可显示属性 - addFilterKey(QObject::tr("native-path")); - addFilterKey(QObject::tr("power supply")); - addFilterKey(QObject::tr("updated")); - addFilterKey(QObject::tr("has history")); - addFilterKey(QObject::tr("has statistics")); - addFilterKey(QObject::tr("rechargeable")); - addFilterKey(QObject::tr("state")); - addFilterKey(QObject::tr("warning-level")); - addFilterKey(QObject::tr("energy")); - addFilterKey(QObject::tr("energy-empty")); - addFilterKey(QObject::tr("energy-full")); - addFilterKey(QObject::tr("energy-full-design")); - addFilterKey(QObject::tr("energy-rate")); - addFilterKey(QObject::tr("voltage")); - addFilterKey(QObject::tr("percentage")); -// addFilterKey(QObject::tr("temperature")); // 温度已经常规显示 - addFilterKey(QObject::tr("technology")); - addFilterKey(QObject::tr("icon-name")); - addFilterKey(QObject::tr("online")); - addFilterKey(QObject::tr("daemon-version")); - addFilterKey(QObject::tr("on-battery")); - addFilterKey(QObject::tr("lid-is-closed")); - addFilterKey(QObject::tr("lid-is-present")); - addFilterKey(QObject::tr("critical-action")); + addFilterKey("native-path"); + addFilterKey("power supply"); + addFilterKey("updated"); + addFilterKey("has history"); + addFilterKey("has statistics"); + addFilterKey("rechargeable"); + addFilterKey("state"); + addFilterKey("warning-level"); + addFilterKey("energy"); + addFilterKey("energy-empty"); + + QString type = Common::specialVendorType(); + if (type != Common::specialHString()) { + addFilterKey("energy-full"); + addFilterKey("energy-full-design"); + } + addFilterKey("energy-rate"); + // addFilterKey("voltage"); + addFilterKey("percentage"); +// addFilterKey("temperature")); // 温度已经常规显示-2 + addFilterKey("technology"); + addFilterKey("icon-name"); + addFilterKey("online"); + addFilterKey("daemon-version"); + addFilterKey("on-battery"); + addFilterKey("lid-is-closed"); + addFilterKey("lid-is-present"); + addFilterKey("critical-action"); } void DevicePower::loadBaseDeviceInfo() { // 添加基本信息 - addBaseDeviceInfo(tr("Name"), m_Name); - addBaseDeviceInfo(tr("Model"), m_Model); - addBaseDeviceInfo(tr("Vendor"), m_Vendor); - addBaseDeviceInfo(tr("Serial Number"), m_SerialNumber); - addBaseDeviceInfo(tr("Type"), m_Type); - addBaseDeviceInfo(tr("Status"), m_Status); - addBaseDeviceInfo(tr("Capacity"), m_Capacity); - addBaseDeviceInfo(tr("Voltage"), m_Voltage); - addBaseDeviceInfo(tr("Slot"), m_Slot); - addBaseDeviceInfo(tr("Design Capacity"), m_DesignCapacity); - addBaseDeviceInfo(tr("Design Voltage"), m_DesignVoltage); - addBaseDeviceInfo(tr("SBDS Version"), m_SBDSVersion); - addBaseDeviceInfo(tr("SBDS Serial Number"), m_SBDSSerialNumber); - addBaseDeviceInfo(tr("SBDS Manufacture Date"), m_SBDSManufactureDate); - addBaseDeviceInfo(tr("SBDS Chemistry"), m_SBDSChemistry); - addBaseDeviceInfo(tr("Temperature"), m_Temp); + addBaseDeviceInfo(("Name"), m_Name); + addBaseDeviceInfo(("Model"), m_Model); + addBaseDeviceInfo(("Vendor"), m_Vendor); + addBaseDeviceInfo(("Serial Number"), m_SerialNumber); + addBaseDeviceInfo(("Type"), m_Type); + addBaseDeviceInfo(("Status"), m_Status); + addBaseDeviceInfo(("Capacity"), m_Capacity); + addBaseDeviceInfo(("Voltage"), m_Voltage); + addBaseDeviceInfo(("Slot"), m_Slot); + addBaseDeviceInfo(("Design Capacity"), m_DesignCapacity); + addBaseDeviceInfo(("Design Voltage"), m_DesignVoltage); + addBaseDeviceInfo(("SBDS Version"), m_SBDSVersion); + addBaseDeviceInfo(("SBDS Serial Number"), m_SBDSSerialNumber); + addBaseDeviceInfo(("SBDS Manufacture Date"), m_SBDSManufactureDate); + addBaseDeviceInfo(("SBDS Chemistry"), m_SBDSChemistry); + addBaseDeviceInfo(("Temperature"), m_Temp); } void DevicePower::loadOtherDeviceInfo() diff --git a/deepin-devicemanager/src/DeviceManager/DevicePrint.cpp b/deepin-devicemanager/src/DeviceManager/DevicePrint.cpp index f829e21e8..63636b6fc 100644 --- a/deepin-devicemanager/src/DeviceManager/DevicePrint.cpp +++ b/deepin-devicemanager/src/DeviceManager/DevicePrint.cpp @@ -125,41 +125,41 @@ bool DevicePrint::enable() void DevicePrint::initFilterKey() { // 初始化可显示属性 - addFilterKey(QObject::tr("copies")); - addFilterKey(QObject::tr("job-cancel-after")); - addFilterKey(QObject::tr("job-hold-until")); - addFilterKey(QObject::tr("job-priority")); - addFilterKey(QObject::tr("marker-change-time")); - addFilterKey(QObject::tr("number-up")); - addFilterKey(QObject::tr("orientation-requested")); - addFilterKey(QObject::tr("print-color-mode")); - addFilterKey(QObject::tr("printer-is-accepting-jobs")); - addFilterKey(QObject::tr("printer-is-shared")); - addFilterKey(QObject::tr("printer-is-temporary")); -// addFilterKey(QObject::tr("printer-make-and-model")); - addFilterKey(QObject::tr("printer-state-change-time")); - addFilterKey(QObject::tr("printer-state-reasons")); - addFilterKey(QObject::tr("printer-type")); - addFilterKey(QObject::tr("printer-uri-supported")); - addFilterKey(QObject::tr("sides")); + addFilterKey("copies"); + addFilterKey("job-cancel-after"); + addFilterKey("job-hold-until"); + addFilterKey("job-priority"); + addFilterKey("marker-change-time"); + addFilterKey("number-up"); + addFilterKey("orientation-requested"); + addFilterKey("print-color-mode"); + addFilterKey("printer-is-accepting-jobs"); + addFilterKey("printer-is-shared"); + addFilterKey("printer-is-temporary"); +// addFilterKey("printer-make-and-model"); + addFilterKey("printer-state-change-time"); + addFilterKey("printer-state-reasons"); + addFilterKey("printer-type"); + addFilterKey("printer-uri-supported"); + addFilterKey("sides"); } void DevicePrint::loadBaseDeviceInfo() { // 添加基本信息 - addBaseDeviceInfo(tr("Name"), m_Name); - addBaseDeviceInfo(tr("Model"), m_Model); - addBaseDeviceInfo(tr("Vendor"), m_Vendor); - addBaseDeviceInfo(tr("Serial Number"), m_SerialNumber); + addBaseDeviceInfo(("Name"), m_Name); + addBaseDeviceInfo(("Model"), m_Model); + addBaseDeviceInfo(("Vendor"), m_Vendor); + addBaseDeviceInfo(("Serial Number"), m_SerialNumber); } void DevicePrint::loadOtherDeviceInfo() { // 添加其他信息,成员变量 - addOtherDeviceInfo(tr("Shared"), m_Shared); - addOtherDeviceInfo(tr("URI"), m_URI); - addOtherDeviceInfo(tr("Status"), m_Status); - addOtherDeviceInfo(tr("Interface Type"), m_InterfaceType); + addOtherDeviceInfo(("Shared"), m_Shared); + addOtherDeviceInfo(("URI"), m_URI); + addOtherDeviceInfo(("Status"), m_Status); + addOtherDeviceInfo(("Interface Type"), m_InterfaceType); addOtherDeviceInfo(QObject::tr("printer-make-and-model"), m_MakeAndModel); // 将QMap内容转存为QList> mapInfoToList(); diff --git a/deepin-devicemanager/src/DeviceManager/DeviceStorage.cpp b/deepin-devicemanager/src/DeviceManager/DeviceStorage.cpp index 81050546f..51089ba4b 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceStorage.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceStorage.cpp @@ -131,8 +131,10 @@ void DeviceStorage::unitConvertByDecimal() m_Size = "256 GB"; } else if(m_SizeBytes > 511*gbyte && m_SizeBytes < 513*gbyte) { m_Size = "512 GB"; - } else if(m_SizeBytes > 999*gbyte && m_SizeBytes < 1001*gbyte) { + } else if(m_SizeBytes > 999*gbyte && m_SizeBytes < 1025*gbyte) { m_Size = "1 TB"; + } else if(m_SizeBytes > 1999*gbyte && m_SizeBytes < 2049*gbyte) { + m_Size = "2 TB"; } } } @@ -283,58 +285,6 @@ QString DeviceStorage::getSerialID(QString &strDeviceLink) return strSerialNumber; } -bool DeviceStorage::setKLUHwinfoInfo(const QMap &mapInfo) -{ - // 龙芯机器中 hwinfo --disk会列出所有的分区信息 - // 存储设备不应包含分区,根据SysFS BusID 来确定是否是分区信息 - if (mapInfo.find("SysFS BusID") == mapInfo.end()) - return false; - - setAttribute(mapInfo, "Model", m_Name); - setAttribute(mapInfo, "Vendor", m_Vendor); - setAttribute(mapInfo, "Driver", m_Driver); // 驱动 - - setAttribute(mapInfo, "Attached to", m_Interface); - QRegExp re(".*\\((.*)\\).*"); - if (re.exactMatch(m_Interface)) { - m_Interface = re.cap(1); - m_Interface.replace("Controller", ""); - m_Interface.replace("controller", ""); - } - - setAttribute(mapInfo, "Revision", m_Version); - setAttribute(mapInfo, "Hardware Class", m_Description); - setAttribute(mapInfo, "Capacity", m_Size); - - // hwinfo里面显示的内容是 14 GB (15376000000 bytes) 需要处理 - QRegExp reSize(".*\\((.*)bytes\\).*"); - if (reSize.exactMatch(m_Size)) { - bool ok = false; - quint64 bytesSize = reSize.cap(1).trimmed().toULongLong(&ok); - if (ok) { - m_Size = decimalkilos(bytesSize); - } else { - m_Size.replace(QRegExp("\\(.*\\)"), "").replace(" ", ""); - } - } else { - m_Size.replace(QRegExp("\\(.*\\)"), "").replace(" ", ""); - } - if (m_Size.startsWith("0") || m_Size == "") - return false; - - setAttribute(mapInfo, "Serial ID", m_SerialNumber); -// setDiskSerialID(mapInfo["Device Files"]); - setAttribute(mapInfo, "SysFS BusID", m_KeyToLshw); - setAttribute(mapInfo, "Device File", m_DeviceFile); - - // KLU里面的介质类型的处理方式比较特殊 - if (mapInfo["Driver"].contains("usb-storage")) - m_MediaType = "USB"; - - getOtherMapInfo(mapInfo); - return true; -} - bool DeviceStorage::addInfoFromlshw(const QMap &mapInfo) { @@ -414,24 +364,6 @@ bool DeviceStorage::setMediaType(const QString &name, const QString &value) return true; } -bool DeviceStorage::setKLUMediaType(const QString &name, const QString &value) -{ - if (!m_DeviceFile.contains(name)) - return false; - - if (m_MediaType == "USB") - return true; - - if (QString("0") == value) - m_MediaType = QObject::tr("SSD"); - else if (QString("1") == value) - m_MediaType = QObject::tr("HDD"); - else - m_MediaType = QObject::tr("Unknown"); - - return true; -} - bool DeviceStorage::isValid() { // 若是m_Size为空则 该设备无效 @@ -590,38 +522,38 @@ const QString DeviceStorage::getOverviewInfo() void DeviceStorage::initFilterKey() { // hwinfo --disk - addFilterKey(QObject::tr("Hardware Class")); - addFilterKey(QObject::tr("Device File")); - addFilterKey(QObject::tr("ansiversion")); - addFilterKey(QObject::tr("bus info")); - addFilterKey(QObject::tr("logical name")); - addFilterKey(QObject::tr("logicalsectorsize")); - // addFilterKey(QObject::tr("physical id")); - addFilterKey(QObject::tr("sectorsize")); - addFilterKey(QObject::tr("guid")); - addFilterKey(QObject::tr("Config Status")); - addFilterKey(QObject::tr("Device Number")); - addFilterKey(QObject::tr("Geometry (Logical)")); + addFilterKey("Hardware Class"); + addFilterKey("Device File"); + addFilterKey("ansiversion"); + addFilterKey("bus info"); + addFilterKey("logical name"); + addFilterKey("logicalsectorsize"); + // addFilterKey("physical id"); + addFilterKey("sectorsize"); + addFilterKey("guid"); + addFilterKey("Config Status"); + addFilterKey("Device Number"); + addFilterKey("Geometry (Logical)"); } void DeviceStorage::loadBaseDeviceInfo() { // 添加基本信息 - addBaseDeviceInfo(tr("Name"), m_Name); - addBaseDeviceInfo(tr("Vendor"), m_Vendor); - addBaseDeviceInfo(tr("Media Type"), m_MediaType); - addBaseDeviceInfo(tr("Size"), m_Size); - addBaseDeviceInfo(tr("Version"), m_Version); - addBaseDeviceInfo(tr("Capabilities"), m_Capabilities); + addBaseDeviceInfo(("Name"), m_Name); + addBaseDeviceInfo(("Vendor"), m_Vendor); + addBaseDeviceInfo(("Media Type"), m_MediaType); + addBaseDeviceInfo(("Size"), m_Size); + addBaseDeviceInfo(("Version"), m_Version); + addBaseDeviceInfo(("Capabilities"), m_Capabilities); } void DeviceStorage::loadOtherDeviceInfo() { // 添加其他信息,成员变量 - addOtherDeviceInfo(tr("Firmware Version"), m_FirmwareVersion); - addOtherDeviceInfo(tr("Speed"), m_Speed); - addOtherDeviceInfo(tr("Description"), m_Description); + addOtherDeviceInfo(("Firmware Version"), m_FirmwareVersion); + addOtherDeviceInfo(("Speed"), m_Speed); + addOtherDeviceInfo(("Description"), m_Description); for(int i = 0 ; i < m_SerialNumber.count(); i++) { QChar cha = m_SerialNumber.at(i); @@ -633,11 +565,11 @@ void DeviceStorage::loadOtherDeviceInfo() } } - addOtherDeviceInfo(tr("Serial Number"), m_SerialNumber); - addOtherDeviceInfo(tr("Interface"), m_Interface); - addOtherDeviceInfo(tr("Rotation Rate"), m_RotationRate); - addOtherDeviceInfo(tr("Module Alias"), m_Modalias); - addOtherDeviceInfo(tr("Physical ID"), m_PhysID); + addOtherDeviceInfo(("Serial Number"), m_SerialNumber); + addOtherDeviceInfo(("Interface"), m_Interface); + addOtherDeviceInfo(("Rotation Rate"), m_RotationRate); + addOtherDeviceInfo(("Module Alias"), m_Modalias); + addOtherDeviceInfo(("Physical ID"), m_PhysID); if (m_RotationRate == QString("Solid State Device")) { m_MediaType = QObject::tr("SSD"); @@ -650,10 +582,10 @@ void DeviceStorage::loadOtherDeviceInfo() void DeviceStorage::loadTableHeader() { // 加载表头信息 - m_TableHeader.append(tr("Name")); - m_TableHeader.append(tr("Vendor")); - m_TableHeader.append(tr("Media Type")); - m_TableHeader.append(tr("Size")); + m_TableHeader.append("Name"); + m_TableHeader.append("Vendor"); + m_TableHeader.append("Media Type"); + m_TableHeader.append("Size"); } void DeviceStorage::loadTableData() @@ -661,7 +593,7 @@ void DeviceStorage::loadTableData() // 加载表格数据 QString model = m_Name; if (!available()) { - model = "(" + tr("Unavailable") + ") " + m_Name; + model = "(Unavailable) " + m_Name; } m_TableData.append(model); m_TableData.append(m_Vendor); diff --git a/deepin-devicemanager/src/DeviceManager/DeviceStorage.h b/deepin-devicemanager/src/DeviceManager/DeviceStorage.h index 7d14aad17..43f505622 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceStorage.h +++ b/deepin-devicemanager/src/DeviceManager/DeviceStorage.h @@ -38,13 +38,6 @@ class DeviceStorage: public DeviceBaseInfo */ bool setHwinfoInfo(const QMap &mapInfo); - /** - * @brief setKLUHwinfoInfo:设置由hwinfo --disk命令获取的设备信息,KLU专用 - * @param mapInfo:由hwinfo获取的信息map - * @return 尔值,true:信息设置成功;false:信息设置失败 - */ - bool setKLUHwinfoInfo(const QMap &mapInfo); - /** * @brief setMediaType:设置存储设备的介质类型 * @param name:存储设备逻辑名称 @@ -53,14 +46,6 @@ class DeviceStorage: public DeviceBaseInfo */ bool setMediaType(const QString &name, const QString &value); - /** - * @brief setKLUMediaType:设置存储设备的介质类型,KLU专用 - * @param name:存储设备逻辑名称 - * @param value:类型值0/1 - * @return 布尔值:true-设置成功;false--设置失败 - */ - bool setKLUMediaType(const QString &name, const QString &value); - /** * @brief addInfoFromlshw:将lshw获取的信息与存储设备进行匹配 * @param mapInfo:由lshw获取的信息map diff --git a/deepin-devicemanager/src/GenerateDevice/CmdTool.cpp b/deepin-devicemanager/src/GenerateDevice/CmdTool.cpp index 0faae52a1..826d15196 100644 --- a/deepin-devicemanager/src/GenerateDevice/CmdTool.cpp +++ b/deepin-devicemanager/src/GenerateDevice/CmdTool.cpp @@ -568,12 +568,7 @@ void CmdTool::getMulHwinfoInfo(const QString &info) // mapInfo["Device"].contains("USB Audio") 是为了处理未识别的USB声卡 Bug-118773 addMapInfo("hwinfo_sound", mapInfo); } else if (mapInfo["Hardware Class"].contains("network")) { - //if (mapInfo.find("SysFS Device Link") != mapInfo.end() && mapInfo["SysFS Device Link"].contains("/devices/platform")) - bool hasAddress = mapInfo.find("HW Address") != mapInfo.end() || mapInfo.find("Permanent HW Address") != mapInfo.end(); - bool hasPath = mapInfo.find("path") != mapInfo.end(); - if (hasPath || hasAddress) { - addMapInfo("hwinfo_network", mapInfo); - } + addMapInfo("hwinfo_network", mapInfo); } else if ("keyboard" == mapInfo["Hardware Class"]) { addMouseKeyboardInfoMapInfo("hwinfo_keyboard", mapInfo); } else if ("mouse" == mapInfo["Hardware Class"]) { diff --git a/deepin-devicemanager/src/GenerateDevice/DeviceFactory.cpp b/deepin-devicemanager/src/GenerateDevice/DeviceFactory.cpp index 38d9f6aee..2a77368e1 100644 --- a/deepin-devicemanager/src/GenerateDevice/DeviceFactory.cpp +++ b/deepin-devicemanager/src/GenerateDevice/DeviceFactory.cpp @@ -7,11 +7,9 @@ #include "X86Generator.h" #include "MipsGenerator.h" #include "ArmGenerator.h" -#include "KLUGenerator.h" #include "PanguGenerator.h" #include "PanguVGenerator.h" #include "HWGenerator.h" -#include "KLVGenerator.h" #include "commonfunction.h" #include "PanguxGenerator.h" @@ -39,11 +37,11 @@ DeviceGenerator *DeviceFactory::getDeviceGenerator() QString type = Common::boardVendorType(); if (!type.isEmpty()) { if (type == "KLVV") - generator = new KLVGenerator(); + generator = new HWGenerator(); else if (type == "PGUV" || type == "PGUW") generator = new PanguVGenerator(); else if (type == "KLVU") - generator = new KLUGenerator(); + generator = new HWGenerator(); else if (type == "PGUX") generator = new PanguXGenerator(); else diff --git a/deepin-devicemanager/src/GenerateDevice/DeviceGenerator.cpp b/deepin-devicemanager/src/GenerateDevice/DeviceGenerator.cpp index 2de58751b..0caccbad8 100644 --- a/deepin-devicemanager/src/GenerateDevice/DeviceGenerator.cpp +++ b/deepin-devicemanager/src/GenerateDevice/DeviceGenerator.cpp @@ -31,6 +31,7 @@ // Qt库文件 #include +#include DeviceGenerator::DeviceGenerator(QObject *parent) : QObject(parent) @@ -245,53 +246,79 @@ void DeviceGenerator::generatorMonitorDevice() void DeviceGenerator::generatorNetworkDevice() { QList lstDevice; - const QList> &lstHWInfo = DeviceManager::instance()->cmdInfo("hwinfo_network"); - for (QList >::const_iterator it = lstHWInfo.begin(); it != lstHWInfo.end(); ++it) { - // Hardware Class 类型为 network interface -// if ("network" == (*it)["Hardware Class"]) { //去掉, 并与service端同步"hwinfo --network"改为 "hwinfo --netcard"获取网卡信息 -// continue; -// } - // 先判断是否是有效网卡信息 - // 符合两种情况中的一种 1. "HW Address" 和 "Permanent HW Address" 都必须有 2. 有 "unique_id" - if (((*it).find("HW Address") == (*it).end() && (*it).find("Permanent HW Address") == (*it).end()) && ((*it).find("unique_id") == (*it).end())) { + QDir dir("/sys/class/net"); + // 获取所有的子目录 + QStringList subDirs = dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot); + + foreach (const QString &subDir, subDirs) { + if (subDir.contains("lo", Qt::CaseInsensitive) || subDir.contains("p2p", Qt::CaseInsensitive)) continue; - } - // 如果(*it)中包含unique_id属性,则说明是从数据库里面获取的,否则是从hwinfo中获取的 - if ((*it).find("unique_id") == (*it).end()) { - DeviceNetwork *device = new DeviceNetwork(); - device->setInfoFromHwinfo(*it); - lstDevice.append(device); - } else { - DeviceNetwork *device = nullptr; - const QString &unique_id = (*it)["unique_id"]; - for (QList::iterator itNet = lstDevice.begin(); itNet != lstDevice.end(); ++itNet) { - if (!unique_id.isEmpty() && (*itNet)->uniqueID() == unique_id) { - device = (*itNet); - } - } - if (device) { - device->setEnableValue(false); + QString addressFilePath = dir.filePath(subDir + "/address"); + QFile addressFile(addressFilePath); + + // 尝试打开文件 + if (addressFile.open(QIODevice::ReadOnly | QIODevice::Text)) { + QTextStream in(&addressFile); + QString address = in.readLine(); // 读取内容 + qDebug() << "Interface:" << subDir << "Address:" << address; + if (address.length() == 17 + && !address.contains("00:00:00:00", Qt::CaseInsensitive) + && !address.contains("ff:ff:ff:ff", Qt::CaseInsensitive)) { + + DeviceNetwork *device = new DeviceNetwork(); + QMap tempMap; + tempMap["Logical Name"] = subDir; + tempMap["MAC Address"] = address; + DeviceManager::instance()->tomlDeviceMapSet(DT_Network, device,tempMap); + lstDevice.append(device); } + addressFile.close(); + } else { + qDebug() << "Failed to open file:" << addressFilePath; } } // 设置从lshw中获取的信息 const QList> &lstLshw = DeviceManager::instance()->cmdInfo("lshw_network"); for (QList >::const_iterator it = lstLshw.begin(); it != lstLshw.end(); ++it) { - if ((*it).find("serial") == (*it).end()) + if ((*it).find("serial") == (*it).end() && (*it).find("logical name") == (*it).end()) continue; - const QString &serialNumber = ((*it).find("logical name") != (*it).end()) ? (*it)["serial"] + (*it)["logical name"] : (*it)["serial"]; + + const QString &serialNumberLshw = (*it)["serial"]; + const QString &logicalNameLshw = (*it)["logical name"]; for (QList::iterator itDevice = lstDevice.begin(); itDevice != lstDevice.end(); ++itDevice) { - const QString &ser2Number = (*itDevice)->logicalName().isEmpty() ? (*itDevice)->hwAddress() : (*itDevice)->hwAddress() + (*itDevice)->logicalName(); - if (!serialNumber.isEmpty() && ((*itDevice)->uniqueID() == serialNumber || ser2Number == serialNumber)) { + const QString &serialNumberLst = (*itDevice)->hwAddress(); + const QString &logicalNameLst = (*itDevice)->logicalName(); + if (serialNumberLshw == serialNumberLst || logicalNameLshw == logicalNameLst) { (*itDevice)->setInfoFromLshw(*it); - break; } } } + const QList> &lstHWInfo = DeviceManager::instance()->cmdInfo("hwinfo_network"); + for (QList >::const_iterator it = lstHWInfo.begin(); it != lstHWInfo.end(); ++it) { + + // 先判断是否是有效网卡信息 + // 符合两种情况中的一种 1. "HW Address" 和 "Permanent HW Address" 都必须有 2. 有 "unique_id" + if (((*it).find("HW Address") == (*it).end() && (*it).find("Permanent HW Address") == (*it).end()) && ((*it).find("unique_id") == (*it).end())) { + continue; + } + + const QString &serialNumberLshw = (*it)["HW Address"]; + const QString &logicalNameLshw = (*it)["Device File"]; + for (QList::iterator itDevice = lstDevice.begin(); itDevice != lstDevice.end(); ++itDevice) { + const QString &serialNumberLst = (*itDevice)->hwAddress(); + const QString &logicalNameLst = (*itDevice)->logicalName(); + if (serialNumberLshw == serialNumberLst || logicalNameLshw == logicalNameLst) { + // (*itDevice)->setEnableValue(false); + (*itDevice)->setInfoFromHwinfo(*it); + } + } + + } + foreach (DeviceNetwork *device, lstDevice) { DeviceManager::instance()->addNetworkDevice(device); } diff --git a/deepin-devicemanager/src/GenerateDevice/HWGenerator.cpp b/deepin-devicemanager/src/GenerateDevice/HWGenerator.cpp index eb4d5f01f..c067a1813 100644 --- a/deepin-devicemanager/src/GenerateDevice/HWGenerator.cpp +++ b/deepin-devicemanager/src/GenerateDevice/HWGenerator.cpp @@ -5,6 +5,8 @@ // 项目自身文件 #include "HWGenerator.h" #include "EDIDParser.h" +#include "commonfunction.h" +#include "DDLog.h" // Qt库文件 #include @@ -27,9 +29,12 @@ #include "DeviceManager/DeviceNetwork.h" #include "DeviceManager/DeviceMemory.h" +static QString boardVendorType; +using namespace DDLog; + HWGenerator::HWGenerator() { - + boardVendorType = Common::boardVendorType(); } void HWGenerator::generatorComputerDevice() @@ -85,6 +90,16 @@ void HWGenerator::generatorCpuDevice() { DeviceGenerator::generatorCpuDevice(); DeviceManager::instance()->setCpuFrequencyIsCur(false); + + if (boardVendorType == "KLVV") { + QList lst = DeviceManager::instance()->convertDeviceList(DT_Cpu); + for (int i = 0; i < lst.size(); i++) { + QMap tempMap; + tempMap["Name"] = "Kirin 9006C"; + DeviceBaseInfo *device = lst[i]; + DeviceManager::instance()->tomlDeviceMapSet(DT_Cpu, device,tempMap); + } + } } void HWGenerator::generatorAudioDevice() @@ -98,6 +113,16 @@ void HWGenerator::generatorBluetoothDevice() getBlueToothInfoFromHwinfo(); getBluetoothInfoFromLshw(); getBluetoothInfoFromCatWifiInfo(); + QList lst = DeviceManager::instance()->convertDeviceList(DT_Bluetoorh); + for (int i = 0; i < lst.size(); i++) { + DeviceBaseInfo *device = lst[i]; + QString vendor = DeviceManager::instance()->tomlDeviceReadKeyValue(DT_Bluetoorh, device, "Vendor"); + if (vendor.contains("HISILICON",Qt::CaseInsensitive)) { + QMap tempMap; + tempMap["Vendor"] = Common::specialHString(); + DeviceManager::instance()->tomlDeviceMapSet(DT_Bluetoorh, device,tempMap); + } + } } void HWGenerator::generatorGpuDevice() @@ -141,69 +166,74 @@ void HWGenerator::generatorGpuDevice() DeviceManager::instance()->addGpuDevice(device); } + void HWGenerator::generatorNetworkDevice() { - QList lstDevice; - const QList> &lstHWInfo = DeviceManager::instance()->cmdInfo("hwinfo_network"); - for (QList >::const_iterator it = lstHWInfo.begin(); it != lstHWInfo.end(); ++it) { - // Hardware Class 类型为 network interface -// if ("network" == (*it)["Hardware Class"]) { -// continue; -// } - - // 先判断是否是有效网卡信息 - // 符合两种情况中的一种 1. "HW Address" 和 "Permanent HW Address" 都必须有 2. 有 "unique_id" - if (((*it).find("HW Address") == (*it).end() || (*it).find("Permanent HW Address") == (*it).end()) && ((*it).find("unique_id") == (*it).end())) { - continue; - } - - // 如果(*it)中包含unique_id属性,则说明是从数据库里面获取的,否则是从hwinfo中获取的 - if ((*it).find("unique_id") == (*it).end()) { - DeviceNetwork *device = new DeviceNetwork(); - device->setInfoFromHwinfo(*it); - if (!device->available()) { - device->setCanEnale(false); - device->setCanUninstall(false); - device->setForcedDisplay(true); - } - lstDevice.append(device); - } else { - DeviceNetwork *device = nullptr; - const QString &unique_id = (*it)["unique_id"]; - for (QList::iterator itNet = lstDevice.begin(); itNet != lstDevice.end(); ++itNet) { - if (!unique_id.isEmpty() && (*itNet)->uniqueID() == unique_id) { - device = (*itNet); - } - } - if (device) { - device->setEnableValue(false); - } - } - } + DeviceGenerator::generatorNetworkDevice(); - // 设置从lshw中获取的信息 - const QList> &lstLshw = DeviceManager::instance()->cmdInfo("lshw_network"); - for (QList >::const_iterator it = lstLshw.begin(); it != lstLshw.end(); ++it) { - if ((*it).find("serial") == (*it).end()) - continue; - const QString &serialNumber = (*it)["serial"]; - for (QList::iterator itDevice = lstDevice.begin(); itDevice != lstDevice.end(); ++itDevice) { - if (!serialNumber.isEmpty() && (*itDevice)->uniqueID() == serialNumber) { - (*itDevice)->setInfoFromLshw(*it); - break; - } - } + if (boardVendorType == "KLVV") { + getNetworkInfoFromCatWifiInfo(); } - foreach (DeviceNetwork *device, lstDevice) { - DeviceManager::instance()->addNetworkDevice(device); - } } void HWGenerator::generatorDiskDevice() { DeviceGenerator::generatorDiskDevice(); DeviceManager::instance()->checkDiskSize(); + + QString bootdevicePath("/proc/bootdevice/product_name"); + QString modelStr = ""; + QFile file(bootdevicePath); + if (file.open(QIODevice::ReadOnly)) { + modelStr = file.readLine().simplified(); + file.close(); + } + if(modelStr.isEmpty()) + return; + + QList lst = DeviceManager::instance()->convertDeviceList(DT_Storage); + for (int i = 0; i < lst.size(); i++) { + DeviceBaseInfo *device = lst[i]; + QString name = DeviceManager::instance()->tomlDeviceReadKeyValue(DT_Storage, device, "Name"); + QString vendor = DeviceManager::instance()->tomlDeviceReadKeyValue(DT_Storage, device, "Vendor"); + if (name == modelStr) { + QMap tempMap; + if (vendor.contains("WDC",Qt::CaseInsensitive)) + tempMap["Vendor"] = "nouse"; + if (name.contains("SDINFDO4-256G",Qt::CaseInsensitive)) + tempMap["Name"] = "nouse"; + // 应HW的要求,将描述固定为 Universal Flash Storage + tempMap["Description"] = "Universal Flash Storage"; + // 应HW的要求,添加interface UFS 3.1 + + if (boardVendorType == "KLVV") + tempMap["Interface"] = "UFS 3.1"; + else if (boardVendorType == "KLVU") { + // 读取interface版本 + QProcess process; + process.start("cat /sys/devices/platform/f8200000.ufs/host0/scsi_host/host0/wb_en"); + process.waitForFinished(-1); + int exitCode = process.exitCode(); + if (exitCode != 127 && exitCode != 126) { + QString deviceInfo = process.readAllStandardOutput(); + if (deviceInfo.trimmed() == "true") { + process.start("cat /sys/block/sdd/device/spec_version"); + process.waitForFinished(-1); + exitCode = process.exitCode(); + if (exitCode != 127 && exitCode != 126) { + deviceInfo = process.readAllStandardOutput(); + if (deviceInfo.trimmed() == "310") { + tempMap["interface"] = "UFS 3.1"; + } + } + } + } + } + + DeviceManager::instance()->tomlDeviceMapSet(DT_Storage, device,tempMap); + } + } } void HWGenerator::getAudioInfoFromCatAudio() @@ -216,12 +246,12 @@ void HWGenerator::getAudioInfoFromCatAudio() QMap tempMap = *it; if (tempMap["Name"].contains("da_combine_v5", Qt::CaseInsensitive)) { - tempMap["Name"] = "Hi6405"; - tempMap["Model"] = "Hi6405"; + tempMap["Name"] = "OnBoard Audio"; + tempMap["Model"] = "OnBoard Audio"; } if (tempMap.contains("Vendor")) { - tempMap["Vendor"]= "HUAWEI"; + tempMap["Vendor"]= Common::specialHString(); } DeviceAudio *device = new DeviceAudio(); @@ -233,41 +263,6 @@ void HWGenerator::getAudioInfoFromCatAudio() } } -void HWGenerator::getDiskInfoFromLshw() -{ - QString bootdevicePath("/proc/bootdevice/product_name"); - QString modelStr = ""; - QFile file(bootdevicePath); - if (file.open(QIODevice::ReadOnly)) { - modelStr = file.readLine().simplified(); - file.close(); - } - - const QList> lstDisk = DeviceManager::instance()->cmdInfo("lshw_disk"); - QList >::const_iterator dIt = lstDisk.begin(); - for (; dIt != lstDisk.end(); ++dIt) { - if ((*dIt).size() < 2) - continue; - - // KLU的问题特殊处理 - QMap tempMap; - foreach (const QString &key, (*dIt).keys()) { - tempMap.insert(key, (*dIt)[key]); - } - -// qCInfo(appLog) << tempMap["product"] << " ***** " << modelStr << " " << (tempMap["product"] == modelStr); - // HW写死 - if (tempMap["product"] == modelStr) { - // 应HW的要求,将描述固定为 Universal Flash Storage - tempMap["description"] = "Universal Flash Storage"; - // 应HW的要求,添加interface UFS 3.0 - tempMap["interface"] = "UFS 3.0"; - } - - DeviceManager::instance()->addLshwinfoIntoStorageDevice(tempMap); - } -} - void HWGenerator::getDiskInfoFromSmartCtl() { const QList> lstMap = DeviceManager::instance()->cmdInfo("smart"); @@ -378,9 +373,9 @@ void HWGenerator::getBluetoothInfoFromCatWifiInfo() tempMap.insert(key, (*it)[key]); } - // cat /sys/hisys/wal/wifi_devices_info 获取结果为 HUAWEI HI103 - if (tempMap["Chip Type"].contains("HUAWEI", Qt::CaseInsensitive)) { - tempMap["Chip Type"] = tempMap["Chip Type"].remove("HUAWEI").trimmed(); + // cat /sys/hisys/wal/wifi_devices_info 获取结果为 HI103 + if (tempMap["Chip Type"].contains(Common::specialHString(), Qt::CaseInsensitive)) { + tempMap["Chip Type"] = tempMap["Chip Type"].remove(Common::specialHString()).trimmed(); } // 按照华为的需求,设置蓝牙制造商和类型 @@ -465,6 +460,21 @@ static void parseEDID(QStringList allEDIDS,QString input) void HWGenerator::generatorMonitorDevice() { + if (boardVendorType == "KLVV" || boardVendorType == "KLVU") { + QMap mapInfo; + mapInfo.insert("Name", "LCD"); + mapInfo.insert("Current Resolution", "2160x1440"); + mapInfo.insert("Support Resolution", "2160x1440"); + mapInfo.insert("Size", "14 Inch"); + mapInfo.insert("Interface Type", "eDP"); + mapInfo.insert("Refresh Rate", "60Hz"); + + DeviceMonitor *monitor = new DeviceMonitor(); + monitor->setInfoFromTomlBase(mapInfo); + monitor->setInfoFromTomlOneByOne(mapInfo); + DeviceManager::instance()->addMonitor(monitor); + } + QString toDir = "/sys/class/drm"; QDir toDir_(toDir); @@ -484,3 +494,140 @@ void HWGenerator::generatorMonitorDevice() } } } + +void HWGenerator::generatorPowerDevice() +{ + DeviceGenerator::generatorPowerDevice(); + + QList lst = DeviceManager::instance()->convertDeviceList(DT_Power); + for (int i = 0; i < lst.size(); i++) { + DeviceBaseInfo *device = lst[i]; + QMap tempMap; + tempMap["energy-full-design"] = "nouse"; + tempMap["energy-full"] = "nouse"; + tempMap["Design Capacity"] = "56 Wh"; + DeviceManager::instance()->tomlDeviceMapSet(DT_Power, device,tempMap); + } +} + +void HWGenerator::generatorKeyboardDevice() +{ + DeviceGenerator::generatorKeyboardDevice(); + + QList lst = DeviceManager::instance()->convertDeviceList(DT_Keyboard); + for (int i = 0; i < lst.size(); i++) { + DeviceBaseInfo *device = lst[i]; + QString vendor = DeviceManager::instance()->tomlDeviceReadKeyValue(DT_Keyboard, device, "Vendor"); + if (vendor.contains("14f3",Qt::CaseInsensitive)) { + QMap tempMap; + tempMap["Vendor"] = Common::specialHString(); + DeviceManager::instance()->tomlDeviceMapSet(DT_Keyboard, device,tempMap); + } + } +} + +void HWGenerator::generatorMemoryDevice() +{ + DeviceGenerator::generatorMemoryDevice(); + + QList lst = DeviceManager::instance()->convertDeviceList(DT_Memory); + for (int i = 0; i < lst.size(); i++) { + DeviceBaseInfo *device = lst[i]; + QString vendor = DeviceManager::instance()->tomlDeviceReadKeyValue(DT_Memory, device, "Vendor"); + QString partNumber = DeviceManager::instance()->tomlDeviceReadKeyValue(DT_Memory, device, "Name"); + if (vendor.contains("Samsung",Qt::CaseInsensitive)) { + QMap tempMap; + tempMap["Vendor"] = "nouse"; + tempMap["Part Number"] = "nouse"; + DeviceManager::instance()->tomlDeviceMapSet(DT_Memory, device,tempMap); + } + if (partNumber.contains("K3LK7K70BM",Qt::CaseInsensitive)) { + QMap tempMap; + tempMap["Name"] = "nouse"; + tempMap["Part Number"] = "nouse"; + DeviceManager::instance()->tomlDeviceMapSet(DT_Memory, device,tempMap); + } + } +} + +void HWGenerator::generatorCameraDevice() +{ + DeviceGenerator::generatorCameraDevice(); + + if (boardVendorType == "KLVV") { + QList lst = DeviceManager::instance()->convertDeviceList(DT_Image); + for (int i = 0; i < lst.size(); i++) { + DeviceBaseInfo *device = lst[i]; + QString vendor = DeviceManager::instance()->tomlDeviceReadKeyValue(DT_Image, device, "Vendor"); + if (vendor.contains("0000058020",Qt::CaseInsensitive)) { + QMap tempMap; + tempMap["Vendor"] = "nouse"; + DeviceManager::instance()->tomlDeviceMapSet(DT_Image, device,tempMap); + } + } + } +} + +void HWGenerator::getNetworkInfoFromCatWifiInfo() +{ + QList > lstWifiInfo; + QString wifiDevicesInfoPath("/sys/hisys/wal/wifi_devices_info"); + QFile file(wifiDevicesInfoPath); + if (file.open(QIODevice::ReadOnly)) { + QMap wifiInfo; + QString allStr = file.readAll(); + file.close(); + + // 解析数据 + QStringList items = allStr.split("\n"); + foreach (const QString &item, items) { + if (item.isEmpty()) + continue; + + QStringList strList = item.split(':', QString::SkipEmptyParts); + if (strList.size() == 2) + wifiInfo[strList[0] ] = strList[1]; + } + + if (!wifiInfo.isEmpty()) + lstWifiInfo.append(wifiInfo); + } + if (lstWifiInfo.size() == 0) { + return; + } + + QList >::const_iterator it = lstWifiInfo.begin(); + for (; it != lstWifiInfo.end(); ++it) { + if ((*it).size() < 3) { + continue; + } + + // KLU的问题特殊处理 + QMap tempMap; + foreach (const QString &key, (*it).keys()) { + tempMap.insert(key, (*it)[key]); + } + + // cat /sys/hisys/wal/wifi_devices_info 获取结果为 HI103 + tempMap["Name"] = tempMap["Chip Type"]; + if (tempMap["Chip Type"].contains(Common::specialHString(), Qt::CaseInsensitive)) { + tempMap["Name"] = tempMap["Chip Type"].remove(Common::specialHString()).trimmed(); + } + + if (tempMap["NIC Type"].contains("WLAN", Qt::CaseInsensitive)) { + } + + // 按照华为的需求,设置蓝牙制造商和类型 + tempMap["Vendor"] = "HISILICON"; + tempMap["Type"] = "Wireless network"; + + QList lst = DeviceManager::instance()->convertDeviceList(DT_Network); + for (int i = 0; i < lst.size(); i++) { + DeviceBaseInfo *device = lst[i]; + QString logicalName = DeviceManager::instance()->tomlDeviceReadKeyValue(DT_Network, device, "Logical Name"); + if (logicalName.contains("wlan", Qt::CaseInsensitive)) { + DeviceManager::instance()->tomlDeviceMapSet(DT_Network, device,tempMap); + } + } + } +} diff --git a/deepin-devicemanager/src/GenerateDevice/HWGenerator.h b/deepin-devicemanager/src/GenerateDevice/HWGenerator.h index 38fa27b48..38a9963e8 100644 --- a/deepin-devicemanager/src/GenerateDevice/HWGenerator.h +++ b/deepin-devicemanager/src/GenerateDevice/HWGenerator.h @@ -54,16 +54,41 @@ class HWGenerator : public DeviceGenerator */ virtual void generatorDiskDevice() override; + /** + * @brief generatorMonitorDevice:生成显示设备信息 + */ + virtual void generatorMonitorDevice() override; + + /** + * @brief generatorPowerDevice:生成电池设备 + */ + virtual void generatorPowerDevice() override; + + /** + * @brief generatorKeyboardDevice:生成键盘设备 + */ + virtual void generatorKeyboardDevice() override; + + /** + * @brief generatorMemoryDevice:生成内存设备 + */ + virtual void generatorMemoryDevice() override; + + /** + * @brief generatorCameraDevice:生成图像设备 + */ + virtual void generatorCameraDevice() override; + protected: /** * @brief getAudioInfoFromCatInput:从cat /proc/bus/input/devices获取音频设备信息 */ virtual void getAudioInfoFromCatAudio() ; - /** - * @brief getDiskInfoFromLshw:从lshw获取存储设备信息 - */ - virtual void getDiskInfoFromLshw() override; + // /** + // * @brief getDiskInfoFromLshw:从lshw获取存储设备信息 + // */ + // virtual void getDiskInfoFromLshw() override; /** * @brief getDiskInfoFromSmartCtl:从smartctl获取存储设备信息 @@ -93,10 +118,9 @@ class HWGenerator : public DeviceGenerator */ virtual void getMemoryInfoFromLshw() override; - /** - * @brief generatorMonitorDevice:生成显示设备信息 - */ - virtual void generatorMonitorDevice() override; + /**@brief:generator network info*/ + virtual void getNetworkInfoFromCatWifiInfo(); + }; #endif // PANGUVGENERATOR_H diff --git a/deepin-devicemanager/src/GenerateDevice/KLUGenerator.cpp b/deepin-devicemanager/src/GenerateDevice/KLUGenerator.cpp deleted file mode 100644 index 8fd6d862b..000000000 --- a/deepin-devicemanager/src/GenerateDevice/KLUGenerator.cpp +++ /dev/null @@ -1,180 +0,0 @@ -// SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -// 项目自身文件 -#include "KLUGenerator.h" - -// Qt库文件 -#include -#include - -// 其它头文件 -#include "DeviceManager/DeviceManager.h" -#include "DeviceManager/DeviceGpu.h" -#include "DeviceManager/DeviceMonitor.h" -#include "DeviceManager/DeviceOthers.h" -#include "DeviceManager/DeviceStorage.h" -#include "DeviceManager/DeviceAudio.h" -#include "DeviceManager/DeviceComputer.h" -#include "DeviceManager/DevicePower.h" -#include "DeviceManager/DeviceInput.h" -#include "DeviceManager/DeviceNetwork.h" - -KLUGenerator::KLUGenerator() -{ - -} - -void KLUGenerator::getDiskInfoFromLshw() -{ - QString bootdevicePath("/proc/bootdevice/product_name"); - QString modelStr = ""; - QFile file(bootdevicePath); - if (file.open(QIODevice::ReadOnly)) { - modelStr = file.readLine().simplified(); - file.close(); - } - - const QList> lstDisk = DeviceManager::instance()->cmdInfo("lshw_disk"); - QList >::const_iterator dIt = lstDisk.begin(); - for (; dIt != lstDisk.end(); ++dIt) { - if ((*dIt).size() < 2) - continue; - - // KLU的问题特殊处理 - QMap tempMap; - foreach (const QString &key, (*dIt).keys()) { - tempMap.insert(key, (*dIt)[key]); - } - -// qCInfo(appLog) << tempMap["product"] << " ***** " << modelStr << " " << (tempMap["product"] == modelStr); - // HW写死 - if (tempMap["product"] == modelStr) { - // 应HW的要求,将描述固定为 Universal Flash Storage - tempMap["description"] = "Universal Flash Storage"; - // 应HW的要求,添加interface UFS 3.0 - tempMap["interface"] = "UFS 3.0"; - - // 读取interface版本 - QProcess process; - process.start("cat /sys/devices/platform/f8200000.ufs/host0/scsi_host/host0/wb_en"); - process.waitForFinished(-1); - int exitCode = process.exitCode(); - if (exitCode != 127 && exitCode != 126) { - QString deviceInfo = process.readAllStandardOutput(); - if (deviceInfo.trimmed() == "true") { - process.start("cat /sys/block/sdd/device/spec_version"); - process.waitForFinished(-1); - exitCode = process.exitCode(); - if (exitCode != 127 && exitCode != 126) { - deviceInfo = process.readAllStandardOutput(); - if (deviceInfo.trimmed() == "310") { - tempMap["interface"] = "UFS 3.1"; - } - } - } - } - } - - DeviceManager::instance()->addLshwinfoIntoStorageDevice(tempMap); - } -} - -void KLUGenerator::generatorNetworkDevice() -{ - const QList> lstInfo = DeviceManager::instance()->cmdInfo("lshw_network"); - QList >::const_iterator it = lstInfo.begin(); - for (; it != lstInfo.end(); ++it) { - if ((*it).size() < 2) { - continue; - } - QMap tempMap = *it; - /* - capabilities: ethernet physical wireless - configuration: broadcast=yes ip=10.4.6.115 multicast=yes wireless=IEEE 802.11 - */ - if ((tempMap["configuration"].indexOf("wireless=IEEE 802.11") > -1) || - (tempMap["capabilities"].indexOf("wireless") > -1)) { - continue; - } - - DeviceNetwork *device = new DeviceNetwork(); - device->setInfoFromLshw(*it); - device->setCanEnale(false); - device->setCanUninstall(false); - device->setForcedDisplay(true); - DeviceManager::instance()->addNetworkDevice(device); - } - // HW 要求修改名称,制造商以及类型 - getNetworkInfoFromCatWifiInfo(); -} - -void KLUGenerator::getNetworkInfoFromCatWifiInfo() -{ - QList > lstWifiInfo; - QString wifiDevicesInfoPath("/sys/hisys/wal/wifi_devices_info"); - QFile file(wifiDevicesInfoPath); - if (file.open(QIODevice::ReadOnly)) { - QMap wifiInfo; - QString allStr = file.readAll(); - file.close(); - - // 解析数据 - QStringList items = allStr.split("\n"); - foreach (const QString &item, items) { - if (item.isEmpty()) - continue; - - QStringList strList = item.split(':', QString::SkipEmptyParts); - if (strList.size() == 2) - wifiInfo[strList[0] ] = strList[1]; - } - - if (!wifiInfo.isEmpty()) - lstWifiInfo.append(wifiInfo); - } - if (lstWifiInfo.size() == 0) { - return; - } - QList >::const_iterator it = lstWifiInfo.begin(); - - for (; it != lstWifiInfo.end(); ++it) { - if ((*it).size() < 3) { - continue; - } - - // KLU的问题特殊处理 - QMap tempMap; - foreach (const QString &key, (*it).keys()) { - tempMap.insert(key, (*it)[key]); - } - - // cat /sys/hisys/wal/wifi_devices_info 获取结果为 HUAWEI HI103 - if (tempMap["Chip Type"].contains("HUAWEI", Qt::CaseInsensitive)) { - tempMap["Chip Type"] = tempMap["Chip Type"].remove("HUAWEI").trimmed(); - } - - // 按照华为的需求,设置蓝牙制造商和类型 - tempMap["Vendor"] = "HISILICON"; - tempMap["Type"] = "Wireless network"; - - DeviceManager::instance()->setNetworkInfoFromWifiInfo(tempMap); - } -} - -void KLUGenerator::generatorMonitorDevice() -{ - QMap mapInfo; - mapInfo.insert("Name", "LCD"); -// mapInfo.insert("Vendor", "HUAWEI"); - mapInfo.insert("CurResolution", "2160x1440@60Hz"); - mapInfo.insert("SupportResolution", "2160x1440@60Hz"); - mapInfo.insert("Size", "14 Inch"); -// mapInfo.insert("Date", "2019年7月"); - - DeviceMonitor *monitor = new DeviceMonitor(); - monitor->setInfoFromSelfDefine(mapInfo); - DeviceManager::instance()->addMonitor(monitor); -} - diff --git a/deepin-devicemanager/src/GenerateDevice/KLUGenerator.h b/deepin-devicemanager/src/GenerateDevice/KLUGenerator.h deleted file mode 100644 index 6f5f10a25..000000000 --- a/deepin-devicemanager/src/GenerateDevice/KLUGenerator.h +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -// SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#ifndef KLUGENERATOR_H -#define KLUGENERATOR_H - -#include"HWGenerator.h" - -/** - * @brief The KLUGenerator class - * 将获取的设备信息生成设备对象,KLU笔记本下的生成器 - */ -class KLUGenerator : public HWGenerator -{ -public: - KLUGenerator(); - -protected: - - /** - * @brief getDiskInfoFromLshw:从lshw获取存储设备信息 - */ - virtual void getDiskInfoFromLshw() override; - - /**@brief:generator network info*/ - virtual void generatorNetworkDevice() override; - - /**@brief:generator network info*/ - virtual void getNetworkInfoFromCatWifiInfo(); - /**@brief:generatorMonitorDevice:生成显示设备*/ - virtual void generatorMonitorDevice(); -}; - -#endif // KLUGENERATOR_H diff --git a/deepin-devicemanager/src/GenerateDevice/KLVGenerator.cpp b/deepin-devicemanager/src/GenerateDevice/KLVGenerator.cpp deleted file mode 100644 index cd2fae69d..000000000 --- a/deepin-devicemanager/src/GenerateDevice/KLVGenerator.cpp +++ /dev/null @@ -1,229 +0,0 @@ -// SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -// 项目自身文件 -#include "KLVGenerator.h" - -// Qt库文件 -#include -#include - -// 其它头文件 -#include "DeviceManager/DeviceManager.h" -#include "DeviceManager/DeviceMonitor.h" -#include "DeviceManager/DeviceNetwork.h" -#include "DeviceManager/DeviceImage.h" - -KLVGenerator::KLVGenerator() -{ - -} - -void KLVGenerator::generatorMonitorDevice() -{ - QMap mapInfo; - mapInfo.insert("Name", "LCD"); -// mapInfo.insert("Vendor", "HUAWEI"); - mapInfo.insert("CurResolution", "2160x1440@60Hz"); - mapInfo.insert("SupportResolution", "2160x1440@60Hz"); - mapInfo.insert("Size", "14 Inch"); -// mapInfo.insert("Date", "2019年7月"); - - DeviceMonitor *monitor = new DeviceMonitor(); - monitor->setInfoFromSelfDefine(mapInfo); - DeviceManager::instance()->addMonitor(monitor); - - HWGenerator::generatorMonitorDevice(); -} - -void KLVGenerator::generatorNetworkDevice() -{ - const QList> lstInfo = DeviceManager::instance()->cmdInfo("lshw_network"); - QList >::const_iterator it = lstInfo.begin(); - for (; it != lstInfo.end(); ++it) { - if ((*it).size() < 2) { - continue; - } - QMap tempMap = *it; - /* - capabilities: ethernet physical wireless - configuration: broadcast=yes ip=10.4.6.115 multicast=yes wireless=IEEE 802.11 - */ - if ((tempMap["configuration"].indexOf("wireless=IEEE 802.11") > -1) || - (tempMap["capabilities"].indexOf("wireless") > -1)) { - continue; - } - - DeviceNetwork *device = new DeviceNetwork(); - device->setInfoFromLshw(*it); - device->setCanEnale(false); - device->setCanUninstall(false); - device->setForcedDisplay(true); - DeviceManager::instance()->addNetworkDevice(device); - } - // HW 要求修改名称,制造商以及类型 - getNetworkInfoFromCatWifiInfo(); -} - -void KLVGenerator::getNetworkInfoFromCatWifiInfo() -{ - QList > lstWifiInfo; - QString wifiDevicesInfoPath("/sys/hisys/wal/wifi_devices_info"); - QFile file(wifiDevicesInfoPath); - if (file.open(QIODevice::ReadOnly)) { - QMap wifiInfo; - QString allStr = file.readAll(); - file.close(); - - // 解析数据 - QStringList items = allStr.split("\n"); - foreach (const QString &item, items) { - if (item.isEmpty()) - continue; - - QStringList strList = item.split(':', QString::SkipEmptyParts); - if (strList.size() == 2) - wifiInfo[strList[0] ] = strList[1]; - } - - if (!wifiInfo.isEmpty()) - lstWifiInfo.append(wifiInfo); - } - if (lstWifiInfo.size() == 0) { - return; - } - QList >::const_iterator it = lstWifiInfo.begin(); - - for (; it != lstWifiInfo.end(); ++it) { - if ((*it).size() < 3) { - continue; - } - - // KLU的问题特殊处理 - QMap tempMap; - foreach (const QString &key, (*it).keys()) { - tempMap.insert(key, (*it)[key]); - } - - // cat /sys/hisys/wal/wifi_devices_info 获取结果为 HUAWEI HI103 - if (tempMap["Chip Type"].contains("HUAWEI", Qt::CaseInsensitive)) { - tempMap["Chip Type"] = tempMap["Chip Type"].remove("HUAWEI").trimmed(); - } - - // 按照华为的需求,设置蓝牙制造商和类型 - tempMap["Vendor"] = "HISILICON"; - tempMap["Type"] = "Wireless network"; - - DeviceManager::instance()->setNetworkInfoFromWifiInfo(tempMap); - } -} - -void KLVGenerator::getDiskInfoFromLshw() -{ - QString bootdevicePath("/proc/bootdevice/product_name"); - QString modelStr = ""; - QFile file(bootdevicePath); - if (file.open(QIODevice::ReadOnly)) { - modelStr = file.readLine().simplified(); - file.close(); - } - - const QList> lstDisk = DeviceManager::instance()->cmdInfo("lshw_disk"); - QList >::const_iterator dIt = lstDisk.begin(); - for (; dIt != lstDisk.end(); ++dIt) { - if ((*dIt).size() < 2) - continue; - - // KLU的问题特殊处理 - QMap tempMap; - foreach (const QString &key, (*dIt).keys()) { - tempMap.insert(key, (*dIt)[key]); - } - -// qCInfo(appLog) << tempMap["product"] << " ***** " << modelStr << " " << (tempMap["product"] == modelStr); - // HW写死 - if (tempMap["product"] == modelStr) { - // 应HW的要求,将描述固定为 Universal Flash Storage - tempMap["description"] = "Universal Flash Storage"; - // 应HW的要求,添加interface UFS 3.1 - tempMap["interface"] = "UFS 3.1"; - } - - DeviceManager::instance()->addLshwinfoIntoStorageDevice(tempMap); - } -} - -void KLVGenerator::getImageInfoFromHwinfo() -{ - // 加载从hwinfo中获取的图像设备信息 - const QList> &lstMap = DeviceManager::instance()->cmdInfo("hwinfo_usb"); - QList >::const_iterator it = lstMap.begin(); - for (; it != lstMap.end(); ++it) { - if ((*it).size() < 3) - continue; - - // hwinfo中对camera的分类不明确,通过camera等关键字认定图像设备 - if (!(*it)["Model"].contains("camera", Qt::CaseInsensitive) && - !(*it)["Device"].contains("camera", Qt::CaseInsensitive) && - !(*it)["Driver"].contains("uvcvideo", Qt::CaseInsensitive) && - !(*it)["Model"].contains("webcam", Qt::CaseInsensitive) && - (*it)["Hardware Class"] != "camera") { - continue; - } - - // KLU的问题特殊处理 - QMap tempMap; - foreach (const QString &key, (*it).keys()) { - if ("Vendor" != key) - tempMap.insert(key, (*it)[key]); - } - - // 判断该摄像头是否存在,被禁用的和被拔出 - QString path = pciPath(tempMap); - if (path.contains("usb")) { - // 判断authorized是否存在,不存在则直接返回 - if (!QFile::exists("/sys" + path + "/authorized")) { - continue; - } - } - - // 判断重复设备数据 - QString unique_id = uniqueID(tempMap); - DeviceImage *device = dynamic_cast(DeviceManager::instance()->getImageDevice(unique_id)); - if (device) { - device->setEnableValue(false); - device->setInfoFromHwinfo(tempMap); - continue; - } else { - if (tempMap.contains("path")) { - continue; - } - } - - device = new DeviceImage(); - device->setInfoFromHwinfo(tempMap); - DeviceManager::instance()->addImageDevice(device); - addBusIDFromHwinfo(tempMap["SysFS BusID"]); - } -} - -void KLVGenerator::getImageInfoFromLshw() -{ - // 加载从lshw中获取的图像设备信息 - const QList> &lstMap = DeviceManager::instance()->cmdInfo("lshw_usb"); - QList >::const_iterator it = lstMap.begin(); - for (; it != lstMap.end(); ++it) { - if ((*it).size() < 2) - continue; - - QMap tempMap; - foreach (const QString &key, (*it).keys()) { - if ("vendor" != key) - tempMap.insert(key, (*it)[key]); - } - - DeviceManager::instance()->setCameraInfoFromLshw(tempMap); - } -} - diff --git a/deepin-devicemanager/src/GenerateDevice/KLVGenerator.h b/deepin-devicemanager/src/GenerateDevice/KLVGenerator.h deleted file mode 100644 index 2338d8c4e..000000000 --- a/deepin-devicemanager/src/GenerateDevice/KLVGenerator.h +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -// SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#ifndef KLVGENERATOR_H -#define KLVGENERATOR_H - -#include"HWGenerator.h" - -/** - * @brief The KLVGenerator class - * 将获取的设备信息生成设备对象,KLU笔记本下的生成器 - */ -class KLVGenerator : public HWGenerator -{ -public: - KLVGenerator(); - -protected: - /** - * @brief generatorMonitorDevice:生成显示设备 - */ - virtual void generatorMonitorDevice() override; - - /**@brief:generator network info*/ - virtual void generatorNetworkDevice() override; - -protected: - /**@brief:generator network info*/ - virtual void getNetworkInfoFromCatWifiInfo(); - - /** - * @brief getDiskInfoFromLshw:从lshw获取存储设备信息 - */ - virtual void getDiskInfoFromLshw() override; - - /** - * @brief getImageInfoFromHwinfo:从hwinfo中获取图像设备信息 - */ - virtual void getImageInfoFromHwinfo() override; - - /** - * @brief getImageInfoFromLshw:从lshw中获取图像设备信息 - */ - virtual void getImageInfoFromLshw() override; -}; - -#endif // KLVGENERATOR_H diff --git a/deepin-devicemanager/src/GenerateDevice/PanguxGenerator.cpp b/deepin-devicemanager/src/GenerateDevice/PanguxGenerator.cpp index d34bcdc09..42c77cb33 100644 --- a/deepin-devicemanager/src/GenerateDevice/PanguxGenerator.cpp +++ b/deepin-devicemanager/src/GenerateDevice/PanguxGenerator.cpp @@ -97,6 +97,6 @@ void PanguXGenerator::generatorCpuDevice() QList lst = DeviceManager::instance()->convertDeviceList(DT_Cpu); for (int i = 0; i < lst.size(); i++) { DeviceBaseInfo *device = lst[i]; - DeviceManager::instance()->tomlDeviceSet(DT_Cpu, device,mapInfo); + DeviceManager::instance()->tomlDeviceMapSet(DT_Cpu, device,mapInfo); } } diff --git a/deepin-devicemanager/src/MacroDefinition.h b/deepin-devicemanager/src/MacroDefinition.h index d64e1caa0..59d68b19c 100644 --- a/deepin-devicemanager/src/MacroDefinition.h +++ b/deepin-devicemanager/src/MacroDefinition.h @@ -43,8 +43,8 @@ foreach (auto device, deviceLst) { \ out << "\n"; \ \ - device->getBaseAttribs(); \ - device->getOtherAttribs(); \ + device->getBaseTranslationAttribs(); \ + device->getOtherTranslationAttribs(); \ /**设备数目大于1,添加子标题**/ \ if (deviceLst.size() > 1) { \ out << device->subTitle(); \ @@ -86,8 +86,8 @@ \ /**添加每个设备的信息**/ \ foreach (auto device, deviceLst) { \ - device->getBaseAttribs(); \ - device->getOtherAttribs(); \ + device->getBaseTranslationAttribs(); \ + device->getOtherTranslationAttribs(); \ \ /**设备数目大于1,添加子标题**/ \ if (deviceLst.size() > 1) { \ @@ -132,8 +132,8 @@ /**添加每个设备的信息**/ \ foreach (auto device, deviceLst) { \ \ - device->getBaseAttribs(); \ - device->getOtherAttribs(); \ + device->getBaseTranslationAttribs(); \ + device->getOtherTranslationAttribs(); \ /**设备数目大于1,添加子标题**/ \ if (deviceLst.size() > 1) { \ doc.addParagraph(device->subTitle()); \ @@ -177,8 +177,8 @@ foreach (auto device, deviceLst) { \ QDomDocument doc; \ \ - device->getBaseAttribs(); \ - device->getOtherAttribs(); \ + device->getBaseTranslationAttribs(); \ + device->getOtherTranslationAttribs(); \ /**设备数目大于1,添加子标题**/ \ if (deviceLst.size() > 1) { \ device->subTitleToHTML(doc); \ diff --git a/deepin-devicemanager/src/Page/PageBoardInfo.cpp b/deepin-devicemanager/src/Page/PageBoardInfo.cpp index 93bf7f079..662476fc8 100644 --- a/deepin-devicemanager/src/Page/PageBoardInfo.cpp +++ b/deepin-devicemanager/src/Page/PageBoardInfo.cpp @@ -55,8 +55,8 @@ void PageBoardInfo::updateInfo(const QList &lst) return; // 获取主板信息并加载 - QList> baseInfoMap = board->getBaseAttribs(); - QList> otherInfoMap = board->getOtherAttribs(); + QList> baseInfoMap = board->getBaseTranslationAttribs(); + QList> otherInfoMap = board->getOtherTranslationAttribs(); baseInfoMap = baseInfoMap + otherInfoMap; loadDeviceInfo(lstOther, baseInfoMap); } @@ -157,7 +157,7 @@ void PageBoardInfo::getOtherInfoPair(const QList &lst, QList pair; - pair.first = bios->name(); + pair.first = bios->nameTr(); getValueInfo(bios, pair); lstPair.append(pair); } @@ -166,8 +166,8 @@ void PageBoardInfo::getOtherInfoPair(const QList &lst, QList &pair) { // 获取信息并保存为pair - QList> baseInfoMap = device->getBaseAttribs(); - QList> otherInfoMap = device->getOtherAttribs(); + QList> baseInfoMap = device->getBaseTranslationAttribs(); + QList> otherInfoMap = device->getOtherTranslationAttribs(); baseInfoMap = baseInfoMap + otherInfoMap; QList>::iterator it = baseInfoMap.begin(); for (; it != baseInfoMap.end(); ++it) { diff --git a/deepin-devicemanager/src/Page/PageDetail.cpp b/deepin-devicemanager/src/Page/PageDetail.cpp index eedc18af1..fe9cf4b77 100644 --- a/deepin-devicemanager/src/Page/PageDetail.cpp +++ b/deepin-devicemanager/src/Page/PageDetail.cpp @@ -199,7 +199,7 @@ void PageDetail::showDeviceInfo(const QList &lstInfo) connect(txtBrowser, &TextBrowser::refreshInfo, this, &PageDetail::refreshInfo); connect(txtBrowser, &TextBrowser::exportInfo, this, &PageDetail::exportInfo); connect(txtBrowser, &TextBrowser::copyAllInfo, this, &PageDetail::slotCopyAllInfo); - addWidgets(txtBrowser, device->enable() && device->available() && !device->getOtherAttribs().isEmpty()); + addWidgets(txtBrowser, device->enable() && device->available() && !device->getOtherTranslationAttribs().isEmpty()); // 当添加到最后一个设备详细信息时,隐藏分隔符 if (device == lstInfo.last()) m_ListDetailSeperator[lstInfo.size() - 1]->setVisible(false); diff --git a/deepin-devicemanager/src/Page/PageSingleInfo.cpp b/deepin-devicemanager/src/Page/PageSingleInfo.cpp index 1c37da152..59511151b 100644 --- a/deepin-devicemanager/src/Page/PageSingleInfo.cpp +++ b/deepin-devicemanager/src/Page/PageSingleInfo.cpp @@ -102,8 +102,8 @@ void PageSingleInfo::updateInfo(const QList &lst) clearContent(); //获取设备信息 - QList> baseInfoMap = lst[0]->getBaseAttribs(); - QList> otherInfoMap = lst[0]->getOtherAttribs(); + QList> baseInfoMap = lst[0]->getBaseTranslationAttribs(); + QList> otherInfoMap = lst[0]->getOtherTranslationAttribs(); baseInfoMap = baseInfoMap + otherInfoMap; // 加载设备信息 diff --git a/deepin-devicemanager/src/Widget/TextBrowser.cpp b/deepin-devicemanager/src/Widget/TextBrowser.cpp index e2749fc63..c63f47ba6 100644 --- a/deepin-devicemanager/src/Widget/TextBrowser.cpp +++ b/deepin-devicemanager/src/Widget/TextBrowser.cpp @@ -62,7 +62,7 @@ void TextBrowser::showDeviceInfo(DeviceBaseInfo *info) // 添加一个表格 if (mp_Info->enable() && mp_Info->available()) { - const QList> &baseInfo = info->getBaseAttribs(); + const QList> &baseInfo = info->getBaseTranslationAttribs(); domTableInfo(doc, baseInfo); } @@ -87,10 +87,10 @@ void TextBrowser::updateInfo() // 添加一个表格 if (mp_Info->enable() && mp_Info->available()) { - const QList> &baseInfo = mp_Info->getBaseAttribs(); + const QList> &baseInfo = mp_Info->getBaseTranslationAttribs(); domTableInfo(doc, baseInfo); if (m_ShowOtherInfo) { - const QList> &otherInfo = mp_Info->getOtherAttribs(); + const QList> &otherInfo = mp_Info->getOtherTranslationAttribs(); domTableInfo(doc, otherInfo); } } diff --git a/deepin-devicemanager/src/commonfunction.cpp b/deepin-devicemanager/src/commonfunction.cpp index c83b43011..1326e133b 100644 --- a/deepin-devicemanager/src/commonfunction.cpp +++ b/deepin-devicemanager/src/commonfunction.cpp @@ -177,6 +177,26 @@ QString Common::boardVendorType() return initBoardVendorFlag ? boardVendorKey : checkBoardVendorFlag(); } +QString Common::specialVendorType() +{ + QString type = Common::boardVendorType(); + if (type == "KLVV" || type == "KLVU" || type == "PGUV" || type == "PGUW") + return specialHString(); + return QString("normalmagical"); +} + +QString Common::specialHString() +{ + int asciiValues[] = {72, 85, 65, 87, 69, 73}; // ASCII values for 'H' .... 'I' + QString result; + + // Convert ASCII values to characters and append to QString + for (int ascii : asciiValues) { + result.append(QChar(ascii)); // Convert ASCII to QChar and append to QString + } + return result; +} + QByteArray Common::executeClientCmd(const QString &cmd, const QStringList &args, const QString &workPath, int msecsWaiting/* = 30000*/) { QProcess process; diff --git a/deepin-devicemanager/src/commonfunction.h b/deepin-devicemanager/src/commonfunction.h index 37868856f..68808b5a7 100644 --- a/deepin-devicemanager/src/commonfunction.h +++ b/deepin-devicemanager/src/commonfunction.h @@ -31,7 +31,8 @@ class Common static QString checkBoardVendorFlag(); static QString boardVendorType(); - + static QString specialVendorType(); + static QString specialHString(); /** * @brief specialComType * special computer type:PGUW(value:1),KLVV/L540(value:2),KLVU(value:3),PGUV/W585(value:4) diff --git a/deepin-devicemanager/tests/src/DeviceManager/ut_deviceinput.cpp b/deepin-devicemanager/tests/src/DeviceManager/ut_deviceinput.cpp index 4d7fd8a5e..96d9deb10 100644 --- a/deepin-devicemanager/tests/src/DeviceManager/ut_deviceinput.cpp +++ b/deepin-devicemanager/tests/src/DeviceManager/ut_deviceinput.cpp @@ -123,46 +123,6 @@ TEST_F(UT_DeviceInput, UT_DeviceInput_setInfoFromHwinfo_002) EXPECT_STREQ("usb@1:8", m_deviceInput->m_HwinfoToLshw.toStdString().c_str()); } -TEST_F(UT_DeviceInput, UT_DeviceInput_setKLUInfoFromHwinfo_001) -{ - QMap map; - setHwinfoMap(map); - map.insert("Device File", "/dev/input/mice (/dev/input/mouse1)"); - - m_deviceInput->setKLUInfoFromHwinfo(map); - EXPECT_STREQ("MX board 8.0", m_deviceInput->m_Name.toStdString().c_str()); - EXPECT_STREQ("Cherry GmbH", m_deviceInput->m_Vendor.toStdString().c_str()); - EXPECT_STREQ("Cherry MX board 8.0", m_deviceInput->m_Model.toStdString().c_str()); - EXPECT_STREQ("1.07", m_deviceInput->m_Version.toStdString().c_str()); - EXPECT_STREQ("USB", m_deviceInput->m_Interface.toStdString().c_str()); - EXPECT_STREQ("1-8:1.1", m_deviceInput->m_BusInfo.toStdString().c_str()); - EXPECT_STREQ("keyboard", m_deviceInput->m_Description.toStdString().c_str()); - EXPECT_STREQ("usbhid", m_deviceInput->m_Driver.toStdString().c_str()); - EXPECT_STREQ("12 Mbps", m_deviceInput->m_Speed.toStdString().c_str()); - EXPECT_STREQ("usb@1:8", m_deviceInput->m_KeyToLshw.toStdString().c_str()); -} - -TEST_F(UT_DeviceInput, UT_DeviceInput_setKLUInfoFromHwinfo_002) -{ - QMap map; - setHwinfoMap(map); - map.insert("Model", "Cherry MX board 8.0 Bluetooth"); - map.insert("Device", "MX board 8.0 Bluetooth"); - map.remove("Hotplug"); - - m_deviceInput->setKLUInfoFromHwinfo(map); - EXPECT_STREQ("MX board 8.0 Bluetooth", m_deviceInput->m_Name.toStdString().c_str()); - EXPECT_STREQ("Cherry GmbH", m_deviceInput->m_Vendor.toStdString().c_str()); - EXPECT_STREQ("Cherry MX board 8.0 Bluetooth", m_deviceInput->m_Model.toStdString().c_str()); - EXPECT_STREQ("1.07", m_deviceInput->m_Version.toStdString().c_str()); - EXPECT_STREQ("Bluetooth", m_deviceInput->m_Interface.toStdString().c_str()); - EXPECT_STREQ("1-8:1.1", m_deviceInput->m_BusInfo.toStdString().c_str()); - EXPECT_STREQ("keyboard", m_deviceInput->m_Description.toStdString().c_str()); - EXPECT_STREQ("usbhid", m_deviceInput->m_Driver.toStdString().c_str()); - EXPECT_STREQ("12 Mbps", m_deviceInput->m_Speed.toStdString().c_str()); - EXPECT_STREQ("usb@1:8", m_deviceInput->m_KeyToLshw.toStdString().c_str()); -} - bool ut_isValueValid() { return true; diff --git a/deepin-devicemanager/tests/src/DeviceManager/ut_devicemanager.cpp b/deepin-devicemanager/tests/src/DeviceManager/ut_devicemanager.cpp index ba6d7dd0f..f34489f27 100644 --- a/deepin-devicemanager/tests/src/DeviceManager/ut_devicemanager.cpp +++ b/deepin-devicemanager/tests/src/DeviceManager/ut_devicemanager.cpp @@ -257,20 +257,7 @@ TEST_F(UT_DeviceManager, UT_DeviceManager_setStorageDeviceMediaType) DeviceManager::instance()->m_ListDeviceStorage.clear(); delete device; } - -TEST_F(UT_DeviceManager, UT_DeviceManager_setKLUStorageDeviceMediaType) -{ - DeviceStorage *device = new DeviceStorage; - device->m_DeviceFile = "/dev/sda"; - DeviceManager::instance()->m_ListDeviceStorage.append(device); - - DeviceManager::instance()->setKLUStorageDeviceMediaType("sda", "1"); - EXPECT_STREQ("HDD", device->m_MediaType.toStdString().c_str()); - - DeviceManager::instance()->m_ListDeviceStorage.clear(); - delete device; -} - +S TEST_F(UT_DeviceManager, UT_DeviceManager_addGpuDevice) { DeviceGpu *gpu = new DeviceGpu; diff --git a/deepin-devicemanager/tests/src/DeviceManager/ut_devicemonitor.cpp b/deepin-devicemanager/tests/src/DeviceManager/ut_devicemonitor.cpp index fe360249c..1d27b7071 100644 --- a/deepin-devicemanager/tests/src/DeviceManager/ut_devicemonitor.cpp +++ b/deepin-devicemanager/tests/src/DeviceManager/ut_devicemonitor.cpp @@ -98,21 +98,6 @@ void ut_monitor_setselfmap(QMap &mapinfo) mapinfo.insert("Date", "Date"); } -TEST_F(UT_DeviceMonitor, UT_DeviceMonitor_setInfoFromSelfDefine) -{ - QMap mapinfo; - ut_monitor_setselfmap(mapinfo); - - m_deviceMonitor->setInfoFromSelfDefine(mapinfo); - EXPECT_STREQ("Name", m_deviceMonitor->m_Name.toStdString().c_str()); - EXPECT_STREQ("Vendor", m_deviceMonitor->m_Vendor.toStdString().c_str()); - EXPECT_STREQ("CurResolution", m_deviceMonitor->m_CurrentResolution.toStdString().c_str()); - EXPECT_STREQ("SupportResolution", m_deviceMonitor->m_SupportResolution.toStdString().c_str()); - EXPECT_STREQ("Size", m_deviceMonitor->m_ScreenSize.toStdString().c_str()); - EXPECT_STREQ("Date", m_deviceMonitor->m_ProductionWeek.toStdString().c_str()); - -} - void ut_monitor_setedidmap(QMap &mapinfo) { mapinfo.insert("Vendor", "Vendor"); diff --git a/deepin-devicemanager/tests/src/DeviceManager/ut_devicenetwork.cpp b/deepin-devicemanager/tests/src/DeviceManager/ut_devicenetwork.cpp index 5be2bdf7b..6465a0aee 100644 --- a/deepin-devicemanager/tests/src/DeviceManager/ut_devicenetwork.cpp +++ b/deepin-devicemanager/tests/src/DeviceManager/ut_devicenetwork.cpp @@ -57,7 +57,7 @@ void ut_network_setlshwinfo(QMap &mapinfo) mapinfo.insert("ip", "ip"); mapinfo.insert("size", "size"); mapinfo.insert("capacity", "capacity"); - mapinfo.insert("latency", "latency"); + mapinfo.insert("Latency", "Latency"); mapinfo.insert("multicast", "multicast"); } @@ -113,7 +113,7 @@ TEST_F(UT_DeviceNetwork, DeviceNetwork_UT_setInfoFromLshw) EXPECT_STREQ("ip", m_deviceNetwork->m_Ip.toStdString().c_str()); EXPECT_STREQ("size", m_deviceNetwork->m_Speed.toStdString().c_str()); EXPECT_STREQ("capacity", m_deviceNetwork->m_Capacity.toStdString().c_str()); - EXPECT_STREQ("latency", m_deviceNetwork->m_Latency.toStdString().c_str()); + EXPECT_STREQ("Latency", m_deviceNetwork->m_Latency.toStdString().c_str()); EXPECT_STREQ("multicast", m_deviceNetwork->m_Multicast.toStdString().c_str()); } diff --git a/deepin-devicemanager/tests/src/DeviceManager/ut_devicestorage.cpp b/deepin-devicemanager/tests/src/DeviceManager/ut_devicestorage.cpp index f2e65a603..fc1531784 100644 --- a/deepin-devicemanager/tests/src/DeviceManager/ut_devicestorage.cpp +++ b/deepin-devicemanager/tests/src/DeviceManager/ut_devicestorage.cpp @@ -127,53 +127,6 @@ TEST_F(UT_DeviceStorage, UT_DeviceStorage_setHwinfoInfo_003) EXPECT_STREQ("", m_deviceStorage->m_SerialNumber.toStdString().c_str()); } -TEST_F(UT_DeviceStorage, UT_DeviceStorage_setKLUHwinfoInfo_001) -{ - QMap mapinfo; - ut_storage_setHwinfoInfo(mapinfo); - mapinfo.insert("Driver", "usb-storage"); - mapinfo.insert("Vendor", "PASON"); - - ASSERT_TRUE(m_deviceStorage->setKLUHwinfoInfo(mapinfo)); - EXPECT_STREQ("ST240BX500SSD1", m_deviceStorage->m_Model.toStdString().c_str()); - EXPECT_STREQ("PASON", m_deviceStorage->m_Vendor.toStdString().c_str()); - EXPECT_STREQ("usb-storage", m_deviceStorage->m_Driver.toStdString().c_str()); - EXPECT_STREQ("SATA ", m_deviceStorage->m_Interface.toStdString().c_str()); - EXPECT_STREQ("R013", m_deviceStorage->m_Version.toStdString().c_str()); - EXPECT_STREQ("disk", m_deviceStorage->m_Description.toStdString().c_str()); - EXPECT_STREQ("223GB", m_deviceStorage->m_Size.toStdString().c_str()); - EXPECT_STREQ("2002E3E0B393", m_deviceStorage->m_SerialNumber.toStdString().c_str()); - EXPECT_STREQ("/dev/nvme0n1", m_deviceStorage->m_DeviceFile.toStdString().c_str()); - EXPECT_STREQ("nvme0n12:0:0:0", m_deviceStorage->m_KeyToLshw.toStdString().c_str()); - EXPECT_STREQ("USB", m_deviceStorage->m_MediaType.toStdString().c_str()); -} - -TEST_F(UT_DeviceStorage, UT_DeviceStorage_setKLUHwinfoInfo_002) -{ - QMap mapinfo; - ut_storage_setHwinfoInfo(mapinfo); - mapinfo.remove("SysFS BusID"); - - ASSERT_FALSE(m_deviceStorage->setKLUHwinfoInfo(mapinfo)); -} - -TEST_F(UT_DeviceStorage, UT_DeviceStorage_setKLUHwinfoInfo_003) -{ - QMap mapinfo; - ut_storage_setHwinfoInfo(mapinfo); - mapinfo.insert("Vendor", "PASON"); - mapinfo.remove("Capacity"); - - ASSERT_FALSE(m_deviceStorage->setKLUHwinfoInfo(mapinfo)); - EXPECT_STREQ("ST240BX500SSD1", m_deviceStorage->m_Model.toStdString().c_str()); - EXPECT_STREQ("PASON", m_deviceStorage->m_Vendor.toStdString().c_str()); - EXPECT_STREQ("ahci, sd", m_deviceStorage->m_Driver.toStdString().c_str()); - EXPECT_STREQ("SATA ", m_deviceStorage->m_Interface.toStdString().c_str()); - EXPECT_STREQ("R013", m_deviceStorage->m_Version.toStdString().c_str()); - EXPECT_STREQ("disk", m_deviceStorage->m_Description.toStdString().c_str()); - EXPECT_STREQ("", m_deviceStorage->m_Size.toStdString().c_str()); -} - TEST_F(UT_DeviceStorage, UT_DeviceStorage_addInfoFromlshw_001) { QMap mapinfo; @@ -273,37 +226,6 @@ TEST_F(UT_DeviceStorage, UT_DeviceStorage_setMediaType_004) EXPECT_TRUE(m_deviceStorage->setMediaType("sda", "2")); } -TEST_F(UT_DeviceStorage, UT_DeviceStorage_setKLUMediaType_001) -{ - m_deviceStorage->m_DeviceFile = "/dev/sda"; - EXPECT_FALSE(m_deviceStorage->setKLUMediaType("nvme0n1", "0")); -} - -TEST_F(UT_DeviceStorage, UT_DeviceStorage_setKLUMediaType_002) -{ - m_deviceStorage->m_DeviceFile = "/dev/sda"; - EXPECT_TRUE(m_deviceStorage->setKLUMediaType("sda", "0")); -} - -TEST_F(UT_DeviceStorage, UT_DeviceStorage_setKLUMediaType_003) -{ - m_deviceStorage->m_DeviceFile = "/dev/sda"; - EXPECT_TRUE(m_deviceStorage->setKLUMediaType("sda", "1")); -} - -TEST_F(UT_DeviceStorage, UT_DeviceStorage_setKLUMediaType_004) -{ - m_deviceStorage->m_DeviceFile = "/dev/sda"; - EXPECT_TRUE(m_deviceStorage->setKLUMediaType("sda", "2")); -} - -TEST_F(UT_DeviceStorage, UT_DeviceStorage_setKLUMediaType_005) -{ - m_deviceStorage->m_DeviceFile = "/dev/sda"; - m_deviceStorage->m_MediaType = "USB"; - EXPECT_TRUE(m_deviceStorage->setKLUMediaType("sda", "2")); -} - TEST_F(UT_DeviceStorage, UT_DeviceStorage_isValid_001) { m_deviceStorage->m_Size = "32GB"; diff --git a/deepin-devicemanager/tests/src/GenerateDevice/ut_klugenerator.cpp b/deepin-devicemanager/tests/src/GenerateDevice/ut_klugenerator.cpp index 597c295b7..192ff895d 100644 --- a/deepin-devicemanager/tests/src/GenerateDevice/ut_klugenerator.cpp +++ b/deepin-devicemanager/tests/src/GenerateDevice/ut_klugenerator.cpp @@ -3,11 +3,9 @@ // // SPDX-License-Identifier: GPL-3.0-or-later -#include "KLUGenerator.h" #include "DeviceManager.h" #include "ut_Head.h" #include "stub.h" - #include #include #include diff --git a/deepin-devicemanager/translations/deepin-devicemanager.ts b/deepin-devicemanager/translations/deepin-devicemanager.ts index 03cf20f00..4de3642db 100644 --- a/deepin-devicemanager/translations/deepin-devicemanager.ts +++ b/deepin-devicemanager/translations/deepin-devicemanager.ts @@ -2199,8 +2199,8 @@ - latency - latency + Latency + Latency diff --git a/deepin-devicemanager/translations/deepin-devicemanager_zh_CN.ts b/deepin-devicemanager/translations/deepin-devicemanager_zh_CN.ts index d12fe7dfb..92b65179c 100644 --- a/deepin-devicemanager/translations/deepin-devicemanager_zh_CN.ts +++ b/deepin-devicemanager/translations/deepin-devicemanager_zh_CN.ts @@ -90,2591 +90,1499 @@ - DeviceAudio + DeviceManager - - Device Name - 设备名称 + + + + + + + + + + + Overview + 概况 - - - Name - 名称 + + + + CPU + 处理器 - - - Vendor - 制造商 + + + CPU quantity + CPU数量 - - Chip - 芯片 + + + Motherboard + 主板 - - Capabilities - 功能 + + + Memory + 内存 - - - Module Alias - 模块别名 + + + Display Adapter + 显示适配器 - - - Physical ID - 物理ID + + + Sound Adapter + 音频适配器 - - SysFS_Path - + + + Storage + 存储设备 - - Description - 描述 + + + Other PCI Devices + 其他PCI设备 - - Revision - + + + Battery + 电池 - - KernelModeDriver - + + + Bluetooth + 蓝牙 - - Memory Address - 内存地址 + + + Network Adapter + 网络适配器 - - IRQ - 中断 + + + Mouse + 鼠标 - - Unavailable - 不可用 + + + Keyboard + 键盘 - - Disable - 禁用 + + + Monitor + 显示设备 - - - DeviceBaseInfo - - Name - 名称 + + + CD-ROM + 光驱 - - Vendor - 制造商 + + + Printer + 打印机 - - Model - 型号 + + + Camera + 图像设备 - - - DeviceBios - - Vendor - 制造商 + + + Other Devices + Other Input Devices + 其他设备 - - Version - 版本 + + + + Device + 设备 - - Chipset - 芯片组 + + + + OS + 操作系统 - DeviceBluetooth - - - Name - 名称 - + GetDriverNameWidget - - Vendor - 制造商 + + + Select a driver for update + 选择需要更新的驱动程序 - - Version - 版本 + + No drivers found in this folder + 所选文件夹未检测到驱动文件 + + + GetInfoPool - - Model - 型号 + + Loading Audio Device Info... + 获取音频设备信息... - - Module Alias - 模块别名 + + Loading BIOS Info... + 获取BIOS信息... - - Physical ID - 物理ID + + Loading CD-ROM Info... + 获取光驱信息... - - Speed - 速度 + + Loading Operating System Info... + 获取操作系统信息... - - Maximum Power - 最大功率 + + Loading CPU Info... + 获取处理器信息... - - Driver Version - 驱动版本 + + Loading Other Devices Info... + 获取其他设备信息... - - Driver - 驱动 + + Loading Power Info... + 获取电池信息... - - Capabilities - 功能 + + Loading Printer Info... + 获取打印机信息... - - Bus Info - 总线信息 + + Loading Mouse Info... + 获取鼠标信息... - - Logical Name - 逻辑名称 + + Loading Network Adapter Info... + 获取网络适配器信息... + + + LogTreeView - - MAC Address - 物理地址 + + + + Disable + 禁用 - + Unavailable 不可用 + + + LogViewItemDelegate - + Disable 禁用 + + + Unavailable + 不可用 + - DeviceCdrom + MainWindow - - Name - 名称 + + Device Info + export file's name + 设备信息 - - Vendor - 制造商 + + Display shortcuts + 显示快捷键 - - Model - 型号 + + Close + 关闭 - - Version - 版本 + + Help + 帮助 - - Bus Info - 总线信息 + + Copy + 复制 - - Capabilities - 功能 + + System + 系统 - - Driver - 驱动 + + Export + 导出 - - Maximum Power - 最大功率 + + Refresh + 刷新 - - Speed - 速度 + + Device Manager + 设备管理器 - - Module Alias - 模块别名 + + Hardware + 硬件信息 - - Physical ID - 物理ID + + Drivers + 驱动管理 - - Unavailable - 不可用 + + Monitor + 显示设备 - - Disable - 禁用 + + Overview + 概况 + + + + Display Adapter + 显示适配器 + + + + CPU + 处理器 + + + + Network Adapter + 网络适配器 + + + + Battery + 电池 - DeviceComputer + PageDetail - - Name - 名称 + + More + 更多 - DeviceCpu + PageDriverBackupInfo - - + + Name 名称 - - - Vendor - 制造商 + + + Current Version + 当前版本 - - CPU ID - 处理器ID + + + Driver Platform Version + 驱动平台版本 - - Core ID - 核心ID + + Status + 状态 - - Threads - 线程数 + + Action + 操作 - - BogoMIPS - 运行速度(Bogomips) + + Backupable Drivers + 可备份驱动 - - - Architecture - 架构 + + Backed up Drivers + 已备份驱动 + + + PageDriverControl - - CPU Family - 家族 + + + Updating + 正在更新 - - Model - 型号 + + + + Cancel + button + 取 消 - - - Processor - 逻辑处理器 + + Next + 下一步 - - Core(s) - + + Warning + 注意 - - Virtualization - 虚拟化 + + The device will be unavailable after the driver uninstallation + 将从系统中卸载此驱动程序,卸载后该设备不可用 - - Flags - 特性 + + Uninstall + button + 卸 载 - - Extensions - 扩展指令集 + + Uninstalling + 正在卸载 - - L3 Cache - L3缓存 + + Update successful + 驱动更新成功 - - L4 Cache - L4缓存 + + Uninstallation successful + 驱动卸载成功 - - L2 Cache - L2缓存 + + Update failed + 驱动更新失败 - - L1i Cache - L1缓存(指令) + + Uninstallation failed + 驱动卸载失败 - - L1d Cache - L1缓存(数据) + + OK + button + 确 定 - - Stepping - 步进 + + Next + button + 下一步 - - Speed - 频率 + + The selected folder does not exist, please select again + 所选文件夹不存在,请重新选择 - - - - Max Speed - 最大频率 + + Update + button + 更 新 - - - DeviceGpu - - Name - 名称 + + Previous + button + 上一步 - - Vendor - 制造商 + + Broken package + 包文件损坏 - - Model - 型号 + + Unmatched package architecture + 包文件与系统架构不匹配 - - Version - 版本 + + + The selected file does not exist, please select again + 所选文件不存在,请重新选择 - - Graphics Memory - 显存 + + It is not a driver + 该文件不是驱动文件 - - Module Alias - 模块别名 + + Unable to install - no digital signature + 无法安装,安装包无数字签名 - - Physical ID - 物理ID + + Unknown error + 未知错误 - - Memory Address - 内存地址 + + The driver module was not found + 未发现该驱动模块 - - IO Port - I/O端口 + + Invalid module format + 模块格式无效 - - Bus Info - 总线信息 + + The driver module has dependencies + 驱动模块被依赖 + + + PageDriverInstallInfo - - Maximum Resolution - 最大分辨率 + + + + Device Name + 设备名称 - - Minimum Resolution - 最小分辨率 + + Version Available + 可安装版本 - - Current Resolution - 当前分辨率 + + + Size + 大小 - - Driver - 驱动 + + + Status + 状态 - - Description - 描述 + + + Action + 操作 - - DP - DP + + New Version + 可更新版本 - - eDP - eDP + + Current Version + 当前版本 - - HDMI - HDMI + + Missing drivers (%1) + 可安装驱动 (%1) - - VGA - VGA + + Outdated drivers (%1) + 可更新驱动 (%1) - - DVI - DVI + + Up-to-date drivers (%1) + 无需更新驱动 (%1) + + + PageDriverManager - - DigitalOutput - DigitalOutput + + + + Driver Install + 驱动安装 - - Display Output - 显示输出 + + + + + Driver Backup + 驱动备份 - - Capabilities - 功能 + + + Driver Restore + 驱动还原 - - IRQ - 中断 + + OK + 确 定 - - Unavailable - 不可用 + + Feedback + 反馈 - DeviceImage + PageDriverRestoreInfo + + + You do not have any drivers to restore, please backup first + 您没有驱动可以还原,请先备份 + + + + Go to Backup Driver + 前往备份驱动 + - + Name 名称 - - Vendor - 制造商 + + Current Version + 当前版本 - - Version - 版本 + + Backup Version + 备份版本 - - Model - 型号 + + Action + 操作 - - Bus Info - 总线信息 + + Restorable Drivers + 可还原驱动 + + + PageListView - - Module Alias - 模块别名 + + Refresh + 刷新 - - Physical ID - 物理ID + + Export + 导出 - - Speed - 速度 + + Overview + 概况 - - Maximum Power - 最大功率 + + Driver Install + 驱动安装 - - Driver - 驱动 + + Driver Backup + 驱动备份 - - Capabilities - 功能 + + Driver Restore + 驱动还原 + + + PageMultiInfo - - Serial Number - 序列号 + + Failed to enable the device + 启用失败 - - Unavailable - 不可用 + + Failed to disable the device + 禁用失败 - - Disable - 禁用 + + Failed to disable it: unable to get the device SN + 无法获取设备序列号,禁用失败 - - - DeviceInput - - Name - 名称 + + Update Drivers + 更新驱动 - - Vendor - 制造商 + + Uninstall Drivers + 卸载驱动 + + + PageOverview - - Model - 型号 + + Refresh + 刷新 - - Interface - 接口 + + Export + 导出 - - Bus Info - 总线信息 + + Copy + 复制 - - Module Alias - 模块别名 + + Overview + 概况 + + + PageSingleInfo - - Physical ID - 物理ID + + Refresh + 刷新 - - Speed - 频率 + + Export + 导出 - - Maximum Current - 最大电流 + + Copy + 复制 - - Driver - 驱动 + + + Enable + 启用 - - Capabilities - 功能 + + Update drivers + 更新驱动 - - Version - 版本 + + Uninstall drivers + 卸载驱动 - - Unavailable - 不可用 + + Allow it to wake the computer + 允许唤起电脑 - + Disable 禁用 - - - DeviceManager - - - - - - - - - - - - Overview - 概况 - - - - - CPU - 处理器 - - - - - CPU quantity - CPU数量 - - - - - Motherboard - 主板 - - - - - Memory - 内存 - - - - - Display Adapter - 显示适配器 - - - - - Sound Adapter - 音频适配器 - - - - - Storage - 存储设备 - - - - - Other PCI Devices - 其他PCI设备 - - - - - Battery - 电池 - - - - - Bluetooth - 蓝牙 - - - - - Network Adapter - 网络适配器 - - - - - Mouse - 鼠标 - - - - - Keyboard - 键盘 - - - - - Monitor - 显示设备 - - - - - CD-ROM - 光驱 - - - - - Printer - 打印机 - - - - - Camera - 图像设备 - - - - - Other Devices - Other Input Devices - 其他设备 - - - - - - Device - 设备 - - - - - - OS - 操作系统 - - - - DeviceMemory - - - - Name - 名称 - - - - - Vendor - 制造商 - - - - - Size - 大小 - - - - - Type - 类型 - - - - - Speed - 速度 - - - - Total Width - 总位宽 - - - - Locator - 插槽 - - - - Serial Number - 序列号 - - - - Configured Voltage - 配置电压 - - - - Maximum Voltage - 最高电压 - - - - Minimum Voltage - 最低电压 - - - - Configured Speed - 配置频率 - - - - Data Width - 数据位宽 - - - - DeviceMonitor - - - Name - 名称 - - - - Vendor - 制造商 - - - - Type - 类型 - - - - Display Input - 显示输入 - - - - Interface Type - 接口类型 - - - - Support Resolution - 支持分辨率 - - - - Current Resolution - 当前分辨率 - - - - Display Ratio - 显示比例 - - - - Primary Monitor - 主显示器 - - - - Size - 大小 - - - - Serial Number - 序列号 - - - - DeviceNetwork - - - - Name - 名称 - - - - - Vendor - 制造商 - - - - - Type - 类型 - - - - Version - 版本 - - - - Bus Info - 总线信息 - - - - Capabilities - 功能 - - - - Driver - 驱动 - - - - Driver Version - 驱动版本 - - - - Module Alias - 模块别名 - - - - Physical ID - 物理ID - - - - Maximum Rate - 最大速率 - - - - Negotiation Rate - 协商速率 - - - - Port - 端口 - - - - Multicast - 组播 - - - - Link - 连接 - - - - Latency - 延迟 - - - - IP - IP - - - - Firmware - 固件 - - - - Duplex - 双工 - - - - Broadcast - 广播 - - - - Auto Negotiation - 自动协商 - - - - Memory Address - 内存地址 - - - - IRQ - 中断 - - - - MAC Address - 物理地址 - - - - Logical Name - 逻辑名称 - - - - Unavailable - 不可用 - - - - Disable - 禁用 - - - - DeviceOtherPCI - - - Name - 名称 - - - - Vendor - 制造商 - - - - Model - 型号 - - - - Bus Info - 总线信息 - - - - Version - 版本 - - - - Input/Output - 输入/输出 - - - - Memory - 内存 - - - - IRQ - 中断 - - - - Latency - 延迟 - - - - Driver - 驱动 - - - - Capabilities - 功能 - - - - DeviceOthers - - - Name - 名称 - - - - Vendor - 制造商 - - - - Model - 型号 - - - - Version - 版本 - - - - Bus Info - 总线信息 - - - - Capabilities - 功能 - - - - Driver - 驱动 - - - - Maximum Power - 最大功率 - - - - Speed - 速度 - - - - Serial Number - 序列号 - - - - Unavailable - 不可用 - - - - Disable - 禁用 - - - - DevicePower - - - Name - 名称 - - - - Model - 型号 - - - - Vendor - 制造商 - - - - Serial Number - 序列号 - - - - Type - 类型 - - - - Status - 状态 - - - - Capacity - 最大容量 - - - - Voltage - 电压 - - - - Slot - 插槽 - - - - Design Capacity - 设计容量 - - - - Design Voltage - 设计电压 - - - - SBDS Version - SBDS版本 - - - - SBDS Serial Number - SBDS序列号 - - - - SBDS Manufacture Date - SBDS制造日期 - - - - SBDS Chemistry - SBDS材料 - - - - Temperature - 温度 - - - - DevicePrint - - - Name - 名称 - - - - Model - 型号 - - - - Vendor - 制造商 - - - - Serial Number - 序列号 - - - - Shared - 已共享 - - - - URI - URI - - - - Status - 状态 - - - - Interface Type - 接口类型 - - - - Disable - 禁用 - - - - DeviceStorage - - - - Vendor - 制造商 - - - - - Media Type - 介质类型 - - - - - - Size - 大小 - - - - - Name - 名称 - - - - Version - 版本 - - - - Capabilities - 功能 - - - - - Module Alias - 模块别名 - - - - - Physical ID - 物理ID - - - - Firmware Version - 固件版本 - - - - Speed - 速度 - - - - Description - 描述 - - - - Serial Number - 序列号 - - - - Interface - 接口 - - - - Rotation Rate - 转速 - - - - Unavailable - 不可用 - - - - GetDriverNameWidget - - - - Select a driver for update - 选择需要更新的驱动程序 - - - - No drivers found in this folder - 所选文件夹未检测到驱动文件 - - - - GetInfoPool - - - Loading Audio Device Info... - 获取音频设备信息... - - - - Loading BIOS Info... - 获取BIOS信息... - - - - Loading CD-ROM Info... - 获取光驱信息... - - - - Loading Operating System Info... - 获取操作系统信息... - - - - Loading CPU Info... - 获取处理器信息... - - - - Loading Other Devices Info... - 获取其他设备信息... - - - - Loading Power Info... - 获取电池信息... - - - - Loading Printer Info... - 获取打印机信息... - - - - Loading Mouse Info... - 获取鼠标信息... - - - - Loading Network Adapter Info... - 获取网络适配器信息... - - - - LogTreeView - - - - - Disable - 禁用 - - - - Unavailable - 不可用 - - - - LogViewItemDelegate - - - Disable - 禁用 - - - - Unavailable - 不可用 - - - - MainWindow - - - Device Info - export file's name - 设备信息 - - - - Display shortcuts - 显示快捷键 - - - - Close - 关闭 - - - - Help - 帮助 - - - - Copy - 复制 - - - - System - 系统 - - - - Export - 导出 - - - - Refresh - 刷新 - - - - Device Manager - 设备管理器 - - - - Hardware - 硬件信息 - - - - Drivers - 驱动管理 - - - - Monitor - 显示设备 - - - - Overview - 概况 - - - - Display Adapter - 显示适配器 - - - - CPU - 处理器 - - - - Network Adapter - 网络适配器 - - - - Battery - 电池 - - - - PageDetail - - - More - 更多 - - - - PageDriverBackupInfo - - - - Name - 名称 - - - - - Current Version - 当前版本 - - - - - Driver Platform Version - 驱动平台版本 - - - - Status - 状态 - - - - Action - 操作 - - - - Backupable Drivers - 可备份驱动 - - - - Backed up Drivers - 已备份驱动 - - - - PageDriverControl - - - - Updating - 正在更新 - - - - - - Cancel - button - 取 消 - - - - Next - 下一步 - - - - Warning - 注意 - - - - The device will be unavailable after the driver uninstallation - 将从系统中卸载此驱动程序,卸载后该设备不可用 - - - - Uninstall - button - 卸 载 - - - - Uninstalling - 正在卸载 - - - - Update successful - 驱动更新成功 - - - - Uninstallation successful - 驱动卸载成功 - - - - Update failed - 驱动更新失败 - - - - Uninstallation failed - 驱动卸载失败 - - - - OK - button - 确 定 - - - - Next - button - 下一步 - - - - The selected folder does not exist, please select again - 所选文件夹不存在,请重新选择 - - - - Update - button - 更 新 - - - - Previous - button - 上一步 - - - - Broken package - 包文件损坏 - - - - Unmatched package architecture - 包文件与系统架构不匹配 - - - - - The selected file does not exist, please select again - 所选文件不存在,请重新选择 - - - - It is not a driver - 该文件不是驱动文件 - - - - Unable to install - no digital signature - 无法安装,安装包无数字签名 - - - - Unknown error - 未知错误 - - - - The driver module was not found - 未发现该驱动模块 - - - - Invalid module format - 模块格式无效 - - - - The driver module has dependencies - 驱动模块被依赖 - - - - PageDriverInstallInfo - - - - - Device Name - 设备名称 - - - - Version Available - 可安装版本 - - - - - Size - 大小 - - - - - Status - 状态 - - - - - Action - 操作 - - - - New Version - 可更新版本 - - - - Current Version - 当前版本 - - - - Missing drivers (%1) - 可安装驱动 (%1) - - - - Outdated drivers (%1) - 可更新驱动 (%1) - - - - Up-to-date drivers (%1) - 无需更新驱动 (%1) - - - - PageDriverManager - - - - - Driver Install - 驱动安装 - - - - - - - Driver Backup - 驱动备份 - - - - - Driver Restore - 驱动还原 - - - - OK - 确 定 - - - - Feedback - 反馈 - - - - PageDriverRestoreInfo - - - You do not have any drivers to restore, please backup first - 您没有驱动可以还原,请先备份 - - - - Go to Backup Driver - 前往备份驱动 - - - - Name - 名称 - - - - Current Version - 当前版本 - - - - Backup Version - 备份版本 - - - - Action - 操作 - - - - Restorable Drivers - 可还原驱动 - - - - PageListView - - - Refresh - 刷新 - - - - Export - 导出 - - - - Overview - 概况 - - - - Driver Install - 驱动安装 - - - - Driver Backup - 驱动备份 - - - - Driver Restore - 驱动还原 - - - - PageMultiInfo - - - Failed to enable the device - 启用失败 + + + Failed to disable it: unable to get the device SN + 无法获取设备序列号,禁用失败 - + Failed to disable the device 禁用失败 - - Failed to disable it: unable to get the device SN - 无法获取设备序列号,禁用失败 + + Failed to enable the device + 启用失败 - + Update Drivers 更新驱动 - + Uninstall Drivers 卸载驱动 - PageOverview +QObject - - Refresh - 刷新 + + + + + CPU + 处理器 - - Export - 导出 + + + + + No CPU found + 未发现处理器 - - Copy - 复制 + + + + + Motherboard + 主板 - - Overview - 概况 + + + + + No motherboard found + 未发现主板 - - - PageSingleInfo - - Refresh - 刷新 + + + + + Memory + 内存 - - Export - 导出 + + + + + No memory found + 未发现内存 - - Copy - 复制 + + + + + Storage + 存储设备 - - - Enable - 启用 + + + + + No disk found + 未发现磁盘 - - Update drivers - 更新驱动 + + Driver restore failed! + 驱动还原失败! - - Uninstall drivers - 卸载驱动 + + + Please try again or give us feedback + 请重试,或反馈给我们 - - Allow it to wake the computer - 允许唤起电脑 + + Driver backup failed! + 驱动备份失败! - - Disable - 禁用 + + + + + + Display Adapter + 显示适配器 - - - Failed to disable it: unable to get the device SN - 无法获取设备序列号,禁用失败 + + + + + No GPU found + 未发现GPU - - Failed to disable the device - 禁用失败 + + + + + Monitor + 显示设备 - - Failed to enable the device - 启用失败 + + + + + No monitor found + 未发现显示设备 - - Update Drivers - 更新驱动 + + + + + + Network Adapter + 网络适配器 - - Uninstall Drivers - 卸载驱动 + + + + + No network adapter found + 未发现网络适配器 - - - QObject - - - SubVendor - 子制造商 + + + + + + Sound Adapter + 音频适配器 - - - SubDevice - 子设备 + + + + + No audio device found + 未发现音频设备 - - Driver - 驱动 + + + + + + Bluetooth + 蓝牙 - - Driver Status - 驱动状态 + + + + + No Bluetooth device found + 未发现蓝牙设备 - - Driver Activation Cmd - 驱动激活命令 + + + + + Other PCI Devices + 其他PCI设备 - - - - - Config Status - 配置状态 + + + + + No other PCI devices found + 未发现其他PCI设备 - - - latency - 延迟 + + + + + Power + 电池 - - Phys - Phys + + + + + No battery found + 未发现电池 - - Sysfs - Sysfs + + + + + + Keyboard + 键盘 + + + + + + + No keyboard found + 未发现键盘 + + + + + + + + Mouse + 鼠标 + + + + + + + No mouse found + 未发现鼠标 - - Handlers - 处理程序 + + + + + + + Printer + 打印机 - - - PROP - PROP + + + + + No printer found + 未发现打印机 - - - EV - EV + + + + + Camera + 图像设备 - - - KEY - KEY + + + + + No camera found + 未发现图像设备 - - Version - 版本 + + + + + CD-ROM + 光驱 - - - - Bus - 总线 + + + + + No CD-ROM found + 未发现光驱 - - - BIOS Information - BIOS信息 + + + + + + Other Devices + 其他设备 - - - Base Board Information - 主板信息 + + + + + No other devices found + 未发现其他设备 - - - System Information - 系统信息 + + + Device Manager + 设备管理器 - - - Chassis Information - 机箱信息 + + Device Manager is a handy tool for viewing hardware information and managing the devices. + 设备管理器是查看、管理硬件设备的工具软件。 - - - Physical Memory Array - 内存插槽信息 + + New drivers available! Install or update them now. + 您有驱动可进行安装/更新 - - Release Date - 发布日期 + + View + 查看 - - Address - 地址 + + Include subfolders + 包括子文件夹 - - Runtime Size - 运行内存大小 + + Search for drivers in this path + 选择驱动所在位置 - - ROM Size - ROM大小 + + %1 driver updates available + 发现%1个驱动可安装更新 - - Characteristics - 特性 + + + Time checked: %1 + 检测时间: %1 - - BIOS Revision - BIOS修订版本 + + Downloading drivers for %1... + 正在下载%1驱动… - - Firmware Revision - 固件修订版本 + + Download speed: %1 Downloaded %2/%3 + 下载速度:%1 已完成 %2/%3 - - - Product Name - 产品名称 + + Installing drivers for %1... + 正在安装%1驱动… - - - - Serial Number - 序列号 + + %1 drivers installed, %2 drivers failed + 驱动安装成功%1个,失败%2个 - - - - Asset Tag - 资产编号 + + %1 drivers installed + 共成功安装%1个驱动 - - - Features - 特征 + + Failed to install drivers + 驱动安装失败 - - Location In Chassis - 机箱内位置 + + Network error. Reconnecting... + 网络异常,重试中 - - Chassis Handle - 机箱程序 + + Download speed: %1 + 下载速度:%1 - - - Type - 类型 + + Your drivers are up to date + 驱动已是最新 - - Contained Object Handles - 包含对象程序 + + All drivers have been backed up + 驱动已全部备份 - - - UUID - UUID + + + A total of %1 drivers, of which %2 have been backed up + 总计%1个驱动,其中%2个已备份 - - Wake-up Type - 唤醒类型 + + You have %1 drivers that can be backed up, it is recommended to do so immediately + 您有%1个驱动可以备份,建议立即备份 - - - SKU Number - SKU号 + + You have %1 drivers that can be backed up + 您有%1个驱动可以备份 - - - Family - 家族 + + Backing up the %1 driver, a total of %2 drivers + 正在备份第%1个驱动,共%2个 - - Lock - + + Backing up: %1 + 正在备份:%1 - - Boot-up State - 开机状态 + + %1 drivers backed up, %2 drivers failed + 驱动备份成功%1个,失败%2个 - - Power Supply State - 供电状态 + + Failed to backup drivers + 备份失败 - - Thermal State - 散热状态 + + %1 drivers backed up + %1个驱动已备份 - - Security Status - 安全状态 + + You have %1 drivers that can be restored + 您有%1个驱动可以还原 - - OEM Information - OEM信息 + + Please select a driver to restore + 请选择驱动还原 - - Height - 高度 + + Driver is restoring... + 驱动还原中… - - Number Of Power Cords - 电源线数 + + Restoring: %1 + 正在还原:%1 - - Contained Elements - 包含组件数 + + reboot + 重启电脑 - - Location - 位置 + + Please %1 for the installed drivers to take effect + 驱动已安装完成,请稍后%1生效 - - Error Correction Type - 纠错类型 + + View backup path + 查看备份路径 - - Maximum Capacity - 最大容量 + + Backup All + 一键备份 - - - Error Information Handle - 错误信息程序 + + + submit feedback + 反馈 - - Number Of Devices - 卡槽数量 + + Please try again or %1 to us + 驱动未安装成功,请重试或%1给我们 - - - BIOS ROMSIZE - BIOS ROM大小 + + + Install All + 一键安装 - - Release date - 发布日期 + + + Scan Again + 重新检测 - - Board name - 主板名称 + + Cancel + 取 消 - - SMBIOS Version - SMBIOS版本 + + Scanning hardware device drivers, please wait... + 正在进行硬件驱动扫描,请耐心等待... - - Language Description Format - 语言描述格式 + + + Scanning %1 + 正在扫描%1 - - Installable Languages - 可安装语言数 + + Scan failed + 检测失败 - - Currently Installed Language - 当前安装语言 + + Network unavailable + 无网络 - - BD Address - 蓝牙设备地址 + + Please check your network connection + 请检查网络连接 - - ACL MTU - ACL MTU + + Please scan again or %1 to us + 请重新检测或%1给我们 - - SCO MTU - SCO MTU + + You are installing a driver, which will be interrupted if you exit. + 当前正在安装驱动,退出应用后任务将会中断 - - Packet type - 数据包类型 + + + + Are you sure you want to exit? + 确认是否退出应用? - - Link policy - 连接策略 + + + + Exit + button + 退 出 - - Link mode - 连接模式 + + + + Cancel + button + 取 消 - - - Class - 类别 + + You are backing up drivers, which will be interrupted if you exit. + 当前正在备份驱动,退出应用后任务将会中断 - - Service Classes - 服务类别 + + You are restoring drivers, which will be interrupted if you exit. + 当前正在还原驱动,退出应用后任务将会中断 - - Device Class - 设备类别 + + Bluetooth adapter + 蓝牙适配器 - - HCI Version - HCI版本 + + + Imaging device + 图像设备 - - LMP Version - LMP版本 + + Display adapter + 显卡 - - Subversion - 子版本 + + Sound card + 声卡 - - - Device - 设备 + + Network adapter + 网卡 - - - Serial ID - 序列号 + + Wireless network adapter + 无线网卡 - - product - 产品 + + Installation successful + 安装成功 - - description - 描述 + + Installation failed + 安装失败 - - Powered - 供电 + + Downloading + 下载中 - - Discoverable - 可发现 + + Installing + 安装中 - - Pairable - 可配对 + + Not installed + 驱动未安装 - - Modalias - 设置命令别名 + + Out-of-date + 驱动可更新 - - Discovering - 搜索中 + + Waiting + 等待中 - - - Driver Modules - 驱动模块 + + Not backed up + 驱动未备份 - - - - - - Device File - 设备文件 + + Backing up + 正在备份 - - Device Files - 设备文件 + + Backup failed + 备份失败 - - - - Device Number - 设备编号 + + Backup successful + 备份成功 - - Application - 应用 + + Restoring + 还原中 - - status - 状态 + + Unknown error + 未知错误 - - - - logical name - 逻辑地址 + + Network error + 网络异常 - - - ansiversion - ANSI版本 + + Canceled + 已取消 - - CPU implementer - CPU程序 + + Failed to get driver files + 驱动文件获取异常 - - CPU architecture - CPU架构 + + Update + 更新 - - CPU variant - CPU变量 + + Backup + 备份 - - CPU part - CPU部件 + + Restore + 还原 - - CPU revision - CPU版本 + + Install + 安装 @@ -3017,1205 +1925,1482 @@ 二百五十六 - - GDDR capacity - GDDR容量 + + Core(s) + - - GPU vendor - GPU供应商 + + BIOS Information + BIOS信息 - - GPU type - GPU类型 + + Base Board Information + 主板信息 - - EGL version - EGL版本 + + System Information + 系统信息 + + + + Chassis Information + 机箱信息 + + + + Physical Memory Array + 内存插槽信息 + + + + Processor + 逻辑处理器 + + + + + inch + 英寸 + + + + + + + + + SSD + 固态 + + + TableWidget - - EGL client APIs - EGL接口 + + + Disable + 禁用 - - GL version - GL版本 + + Refresh + 刷新 - - GLSL version - GLSL版本 + + Export + 导出 - - - - Unknown - 未知 + + Update drivers + 更新驱动 - - Uniq - Uniq + + Uninstall drivers + 卸载驱动 - - MSC - MSC + + Allow it to wake the computer + 允许唤起电脑 - - - - Hardware Class - 硬件类别 + + + Enable + 启用 + + + + TextBrowser - - - - - CPU - 处理器 + + Refresh + 刷新 - - - - - No CPU found - 未发现处理器 + + Export + 导出 - - - - - Motherboard - 主板 + + Copy + 复制 - - - - - No motherboard found - 未发现主板 + + Disable + 禁用 - - - - - Memory - 内存 + + Unavailable + 不可用 + + + UrlChooserEdit - - - - - No memory found - 未发现内存 + + Select a local folder please + 请选择本地文件夹 + + + WaitingWidget - - - - - Storage - 存储设备 + + Loading... + 正在载入... + + + DeviceBaseInfo - - - - - No disk found - 未发现磁盘 + + Device Name + 设备名称 - - - Driver restore failed! - 驱动还原失败! + + + + Vendor + 制造商 - - - Please try again or give us feedback - 请重试,或反馈给我们 + + Chip + 芯片 - - Driver backup failed! - 驱动备份失败! + + + Physical ID + 物理ID - - - - - - Display Adapter - 显示适配器 + + SysFS_Path + - - - - - No GPU found - 未发现GPU + + Revision + - - - - - Monitor - 显示设备 + + KernelModeDriver + - - - - - No monitor found - 未发现显示设备 + + IRQ + 中断 - - - - - - Network Adapter - 网络适配器 + + Disable + 禁用 - - - - - No network adapter found - 未发现网络适配器 + + Version + 版本 - - - - - - Sound Adapter - 音频适配器 + + Chipset + 芯片组 - - - - - - No audio device found - 未发现音频设备 + + + Module Alias + 模块别名 - - - - - - - Bluetooth - 蓝牙 + + + Speed + 速度 - - - - - No Bluetooth device found - 未发现蓝牙设备 + + Maximum Power + 最大功率 - - - - - Other PCI Devices - 其他PCI设备 + + Driver + 驱动 - - - - - No other PCI devices found - 未发现其他PCI设备 + + Driver Version + 驱动版本 - - - - - Power - 电池 + + Capabilities + 功能 - - - - - No battery found - 未发现电池 + + logical name + 逻辑名称 - - - - - - Keyboard - 键盘 + + Logical Name + 逻辑名称 - - - - - No keyboard found - 未发现键盘 + + MAC Address + 物理地址 - - - - - - Mouse - 鼠标 + + CPU ID + 处理器ID - - - - - No mouse found - 未发现鼠标 + + Core ID + 核心ID - - - - - - - Printer - 打印机 + + Threads + 线程数 - - - - - No printer found - 未发现打印机 + + BogoMIPS + 运行速度(Bogomips) - - - - - Camera - 图像设备 + + Architecture + 架构 - - - - - No camera found - 未发现图像设备 + + CPU Family + 家族 - - - - - CD-ROM - 光驱 + + + Processor + 逻辑处理器 - - - - - No CD-ROM found - 未发现光驱 + + Core(s) + - - - - - - Other Devices - 其他设备 + + Virtualization + 虚拟化 - - - - - No other devices found - 未发现其他设备 + + Flags + 特性 - - Array Handle - 数组程序 + + Extensions + 扩展指令集 - - Form Factor - 尺寸型号 + + L3 Cache + L3缓存 - - Set - 设置 + + L4 Cache + L4缓存 - - Bank Locator - 内存通道 + + L2 Cache + L2缓存 - - Type Detail - 类型详情 + + L1i Cache + L1缓存(指令) - - Part Number - 部件号码 + + L1d Cache + L1缓存(数据) - - Rank - 位列 + + Stepping + 步进 - - Memory Technology - 内存技术 + + Frequency + 频率 - - Memory Operating Mode Capability - 内存操作模式 + + + + Max Frequency + 最大频率 - - Firmware Version - 固件版本 + + Graphics Memory + 显存 - - Module Manufacturer ID - 组件制造商 + + Memory Address + 内存地址 - - Module Product ID - 组件产品ID + + IO Port + I/O端口 - - Memory Subsystem Controller Manufacturer ID - 内存子系统控制器制造商 + + Maximum Resolution + 最大分辨率 - - Memory Subsystem Controller Product ID - 内存子系统控制器产品ID + + Minimum Resolution + 最小分辨率 - - Non-Volatile Size - 不易丢失大小 + + Description + 描述 - - Volatile Size - 易丢失大小 + + DP + DP - - Cache Size - 缓存大小 + + eDP + eDP - - Logical Size - 逻辑大小 + + HDMI + HDMI - - - - - - inch - 英寸 + + VGA + VGA - - Date - 日期 + + DVI + DVI - - ioport - I/O端口 + + DigitalOutput + DigitalOutput - - network - 网络 + + Display Output + 显示输出 - - - battery - 电池 + + + Interface + 接口 - - native-path - 安装路径 + + Bus Info + 总线信息 - - power supply - 供电 + + bus info + 总线信息 + + + + Maximum Current + 最大电流 - - updated - 更新时间 + + Unavailable + 不可用 - - has history - 历史记录 + + Type + 类型 - - has statistics - 用电统计 + + Total Width + 总位宽 - - rechargeable - 可再充电 + + Locator + 插槽 - - state - 状态 + + Configured Voltage + 配置电压 - - warning-level - 警告等级 + + Maximum Voltage + 最高电压 - - energy - 容量 + + Minimum Voltage + 最低电压 - - energy-empty - 最低容量 + + Configured Speed + 配置速度 - - energy-full - 完全充满容量 + + Data Width + 数据位宽 + + + + Display Input + 显示输入 - - energy-full-design - 设计容量 + + Interface Type + 接口类型 - - energy-rate - 能量密度 + + Support Resolution + 支持分辨率 - - voltage - 电压 + + Current Resolution + 当前分辨率 - - percentage - 电量 + + Refresh Rate + 刷新率 + + + + Display Ratio + 显示比例 - - technology - 电池技术 + + Primary Monitor + 主显示器 - - icon-name - 图标 + + Size + 大小 - - online - 在线 + + Maximum Rate + 最大速率 - - daemon-version - Daemon版本 + + Negotiation Rate + 协商速率 - - on-battery - 使用电池 + + Port + 端口 - - lid-is-closed - 笔记本合盖 + + Multicast + 组播 - - lid-is-present - 打开笔记本盖子 + + Link + 连接 - - critical-action - 电量极低时执行 + + Latency + 延迟 - - copies - 复印数量 + + IP + IP - - job-cancel-after - 此时取消打印任务 + + Firmware + 固件 - - job-hold-until - 保留打印任务直至 + + Duplex + 双工 - - job-priority - 任务优先级 + + Broadcast + 广播 - - marker-change-time - 标记修改次数 + + Auto Negotiation + 自动协商 - - number-up - 编号 + + Input/Output + 输入/输出 - - orientation-requested - 打印方向 + + Memory + 内存 + + + + Model + 型号 + + + + Status + 状态 - - print-color-mode - 颜色模式 + + Capacity + 最大容量 - - printer-is-accepting-jobs - 当前可打印 + + Voltage + 电压 - - printer-is-shared - 打印机已共享 + + Slot + 插槽 - - printer-is-temporary - 临时打印机 + + Design Capacity + 设计容量 - - printer-make-and-model - 制造商和型号 + + Design Voltage + 设计电压 - - printer-state-change-time - 打印机状态修改时间 + + SBDS Version + SBDS版本 - - printer-state-reasons - 打印机状态信息 + + SBDS Serial Number + SBDS序列号 - - printer-type - 打印机类型 + + SBDS Manufacture Date + SBDS制造日期 - - printer-uri-supported - 支持的URI + + SBDS Chemistry + SBDS材料 - - sides - 打印面数 + + Temperature + 温度 - - - - - - - SSD - 固态 + + Name + 名称 + + + + Shared + 已共享 - - - HDD - 机械 + + URI + URI - - - bus info - 总线信息 + + Media Type + 介质类型 - - logicalsectorsize - 逻辑分区大小 + + Firmware Version + 固件版本 - - sectorsize - 扇区大小 + + Serial Number + 序列号 - - guid - 全局唯一标识符 + + Rotation Rate + 转速 - - Geometry (Logical) - 几何数据(逻辑) + + SubVendor + 子制造商 - - - Device Manager - 设备管理器 + + SubDevice + 子设备 - - Device Manager is a handy tool for viewing hardware information and managing the devices. - 设备管理器是查看、管理硬件设备的工具软件。 + + Driver Status + 驱动状态 - - New drivers available! Install or update them now. - 您有驱动可进行安装/更新 + + Config Status + 配置状态 - - View - 查看 + + Phys + Phys - - Include subfolders - 包括子文件夹 + + Sysfs + Sysfs - - Search for drivers in this path - 选择驱动所在位置 + + Handlers + 处理程序 - - %1 driver updates available - 发现%1个驱动可安装更新 + + PROP + PROP - - - Time checked: %1 - 检测时间: %1 + + EV + EV - - Downloading drivers for %1... - 正在下载%1驱动… + + KEY + KEY - - Download speed: %1 Downloaded %2/%3 - 下载速度:%1 已完成 %2/%3 + + Bus + 总线 - - Installing drivers for %1... - 正在安装%1驱动… + + BIOS Information + BIOS信息 - - %1 drivers installed, %2 drivers failed - 驱动安装成功%1个,失败%2个 + + Base Board Information + 主板信息 - - %1 drivers installed - 共成功安装%1个驱动 + + System Information + 系统信息 - - Failed to install drivers - 驱动安装失败 + + Chassis Information + 机箱信息 - - Network error. Reconnecting... - 网络异常,重试中 + + Physical Memory Array + 内存插槽信息 - - Download speed: %1 - 下载速度:%1 + + Release Date + 发布日期 - - Your drivers are up to date - 驱动已是最新 + + Address + 地址 - - All drivers have been backed up - 驱动已全部备份 + + Runtime Size + 运行内存大小 - - - A total of %1 drivers, of which %2 have been backed up - 总计%1个驱动,其中%2个已备份 + + ROM Size + ROM大小 - - You have %1 drivers that can be backed up, it is recommended to do so immediately - 您有%1个驱动可以备份,建议立即备份 + + Characteristics + 特性 - - You have %1 drivers that can be backed up - 您有%1个驱动可以备份 + + BIOS Revision + BIOS修订版本 - - Backing up the %1 driver, a total of %2 drivers - 正在备份第%1个驱动,共%2个 + + Firmware Revision + 固件修订版本 - - Backing up: %1 - 正在备份:%1 + + Product Name + 产品名称 - - %1 drivers backed up, %2 drivers failed - 驱动备份成功%1个,失败%2个 + + Asset Tag + 资产编号 - - Failed to backup drivers - 备份失败 + + Features + 特征 - - %1 drivers backed up - %1个驱动已备份 + + Location In Chassis + 机箱内位置 - - You have %1 drivers that can be restored - 您有%1个驱动可以还原 + + Chassis Handle + 机箱程序 - - Please select a driver to restore - 请选择驱动还原 + + Contained Object Handles + 包含对象程序 - - Driver is restoring... - 驱动还原中… + + UUID + UUID - - Restoring: %1 - 正在还原:%1 + + Wake-up Type + 唤醒类型 - - reboot - 重启电脑 + + SKU Number + SKU号 - - Please %1 for the installed drivers to take effect - 驱动已安装完成,请稍后%1生效 + + Family + 家族 - - View backup path - 查看备份路径 + + Lock + - - Backup All - 一键备份 + + Boot-up State + 开机状态 - - - submit feedback - 反馈 + + Power Supply State + 供电状态 - - Please try again or %1 to us - 驱动未安装成功,请重试或%1给我们 + + Thermal State + 散热状态 - - Install All - 一键安装 + + Security Status + 安全状态 - - - Scan Again - 重新检测 + + OEM Information + OEM信息 - - Cancel - 取 消 + + Height + 高度 - - Scanning hardware device drivers, please wait... - 正在进行硬件驱动扫描,请耐心等待... + + Number Of Power Cords + 电源线数 - - - Scanning %1 - 正在扫描%1 + + Contained Elements + 包含组件数 - - Scan failed - 检测失败 + + Location + 位置 - - Network unavailable - 无网络 + + Error Correction Type + 纠错类型 - - Please check your network connection - 请检查网络连接 + + Maximum Capacity + 最大容量 - - Please scan again or %1 to us - 请重新检测或%1给我们 + + Error Information Handle + 错误信息程序 - - You are installing a driver, which will be interrupted if you exit. - 当前正在安装驱动,退出应用后任务将会中断 + + Number Of Devices + 卡槽数量 + + + + BIOS ROMSIZE + BIOS ROM大小 - - - - Are you sure you want to exit? - 确认是否退出应用? + + Release date + 发布日期 - - - - Exit - button - 退 出 + + Board name + 主板名称 - - - - Cancel - button - 取 消 + + SMBIOS Version + SMBIOS版本 - - You are backing up drivers, which will be interrupted if you exit. - 当前正在备份驱动,退出应用后任务将会中断 + + Language Description Format + 语言描述格式 - - You are restoring drivers, which will be interrupted if you exit. - 当前正在还原驱动,退出应用后任务将会中断 + + Installable Languages + 可安装语言数 - - Bluetooth adapter - 蓝牙适配器 + + Currently Installed Language + 当前安装语言 - - - Imaging device - 图像设备 + + BD Address + 蓝牙设备地址 - - Display adapter - 显卡 + + ACL MTU + ACL MTU - - Sound card - 声卡 + + SCO MTU + SCO MTU - - Network adapter - 网卡 + + Packet type + 数据包类型 - - Wireless network adapter - 无线网卡 + + Link policy + 连接策略 - - Installation successful - 安装成功 + + Link mode + 连接模式 - - Installation failed - 安装失败 + + Class + 类别 - - Downloading - 下载中 + + Service Classes + 服务类别 - - Installing - 安装中 + + Device Class + 设备类别 - - Not installed - 驱动未安装 + + HCI Version + HCI版本 - - Out-of-date - 驱动可更新 + + LMP Version + LMP版本 - - Waiting - 等待中 + + Subversion + 子版本 - - Not backed up - 驱动未备份 + + Device + 设备 - - Backing up - 正在备份 + + Serial ID + 序列号 - - Backup failed - 备份失败 + + product + 产品 + + + + Powered + 供电 - - Backup successful - 备份成功 + + Discoverable + 可发现 - - Restoring - 还原中 + + Pairable + 可配对 - - Unknown error - 未知错误 + + Modalias + 设置命令别名 - - Network error - 网络异常 + + Discovering + 搜索中 - - Canceled - 已取消 + + Device File + 设备文件 - - Failed to get driver files - 驱动文件获取异常 + + Device Files + 设备文件 - - Update - 更新 + + Device Number + 设备编号 - - Backup - 备份 + + Application + 应用 + + + + ansiversion + ANSI版本 - - Restore - 还原 + + CPU implementer + CPU程序 - - Install - 安装 + + CPU architecture + CPU架构 - - - TableWidget - - - Disable - 禁用 + + CPU variant + CPU变量 - - Refresh - 刷新 + + CPU part + CPU部件 - - Export - 导出 + + CPU revision + CPU版本 - - Update drivers - 更新驱动 + + GDDR capacity + GDDR容量 - - Uninstall drivers - 卸载驱动 + + GPU vendor + GPU供应商 - - Allow it to wake the computer - 允许唤起电脑 + + GPU type + GPU类型 - - - Enable - 启用 + + EGL version + EGL版本 - - - TextBrowser - - Refresh - 刷新 + + EGL client APIs + EGL接口 - - Export - 导出 + + GL version + GL版本 - - Copy - 复制 + + GLSL version + GLSL版本 - - Disable - 禁用 + + + + Unknown + 未知 - - Unavailable - 不可用 + + Uniq + Uniq - - - UrlChooserEdit - - Select a local folder please - 请选择本地文件夹 + + MSC + MSC - - - WaitingWidget - - Loading... - 正在载入... + + + + Hardware Class + 硬件类别 + + + Array Handle + 数组程序 + + + + Form Factor + 尺寸型号 + + + + Set + 设置 + + + + Bank Locator + 内存通道 + + + + Part Number + 部件号码 + + + + Rank + 位列 + + + + Memory Technology + 内存技术 + + + + Memory Operating Mode Capability + 内存操作模式 + + + + Module Manufacturer ID + 组件制造商 + + + + Module Product ID + 组件产品ID + + + + Memory Subsystem Controller Manufacturer ID + 内存子系统控制器制造商 + + + + Memory Subsystem Controller Product ID + 内存子系统控制器产品ID + + + + Non-Volatile Size + 不易丢失大小 + + + + Volatile Size + 易丢失大小 + + + + Cache Size + 缓存大小 + + + + Logical Size + 逻辑大小 + + + + inch + 英寸 + + + + Date + 日期 + + + + ioport + I/O端口 + + + + network + 网络 + + + + battery + 电池 + + + + native-path + 安装路径 + + + + power supply + 供电 + + + + updated + 更新时间 + + + + has history + 历史记录 + + + + has statistics + 用电统计 + + + + rechargeable + 可再充电 + + + + state + 状态 + + + + warning-level + 警告等级 + + + + energy + 容量 + + + + energy-empty + 最低容量 + + + + energy-full + 完全充满容量 + + + + energy-full-design + 设计容量 + + + + energy-rate + 能量密度 + + + + percentage + 电量 + + + + technology + 电池技术 + + + + icon-name + 图标 + + + + online + 在线 + + + + daemon-version + Daemon版本 + + + + on-battery + 使用电池 + + + + lid-is-closed + 笔记本合盖 + + + + lid-is-present + 打开笔记本盖子 + + + + critical-action + 电量极低时执行 + + + + copies + 复印数量 + + + + job-cancel-after + 此时取消打印任务 + + + + job-hold-until + 保留打印任务直至 + + + + job-priority + 任务优先级 + + + + marker-change-time + 标记修改次数 + + + + number-up + 编号 + + + + orientation-requested + 打印方向 + + + + print-color-mode + 颜色模式 + + + + printer-is-accepting-jobs + 当前可打印 + + + + printer-is-shared + 打印机已共享 + + + + printer-is-temporary + 临时打印机 + + + + printer-make-and-model + 制造商和型号 + + + + printer-state-change-time + 打印机状态修改时间 + + + + printer-state-reasons + 打印机状态信息 + + + + printer-type + 打印机类型 + + + + printer-uri-supported + 支持的URI + + + + sides + 打印面数 + + + + SSD + 固态 + + + + HDD + 机械 + + + + logicalsectorsize + 逻辑分区大小 + + + + sectorsize + 扇区大小 + + + + guid + 全局唯一标识符 + + + + Geometry (Logical) + 几何数据(逻辑) + From c08fc94979c0b0c44f0d88a236925aac8b02400a Mon Sep 17 00:00:00 2001 From: shuaijie Date: Thu, 28 Nov 2024 10:13:21 +0800 Subject: [PATCH 02/69] chore: extend toml extend toml and uniform some model arm code Log: extend toml Bug: https://pms.uniontech.com/task-view-368603.html --- .../oeminfo_sampleAnduseGuideLine_zh_CN.toml | 4 +- .../assets/org.deepin.devicemanager.json | 18 +- .../src/DeviceManager/DeviceAudio.cpp | 4 +- .../src/DeviceManager/DeviceBios.cpp | 2 +- .../src/DeviceManager/DeviceBluetooth.cpp | 22 +- .../src/DeviceManager/DeviceBluetooth.h | 7 - .../src/DeviceManager/DeviceCdrom.cpp | 4 +- .../src/DeviceManager/DeviceCpu.cpp | 164 ++-- .../src/DeviceManager/DeviceGpu.cpp | 2 +- .../src/DeviceManager/DeviceImage.cpp | 4 +- .../src/DeviceManager/DeviceInfo.cpp | 10 +- .../src/DeviceManager/DeviceInput.cpp | 4 +- .../src/DeviceManager/DeviceManager.cpp | 125 ++- .../src/DeviceManager/DeviceManager.h | 19 +- .../src/DeviceManager/DeviceMonitor.cpp | 6 +- .../src/DeviceManager/DeviceNetwork.cpp | 23 +- .../src/DeviceManager/DeviceNetwork.h | 7 - .../src/DeviceManager/DeviceOthers.cpp | 4 +- .../src/DeviceManager/DevicePower.cpp | 3 +- .../src/DeviceManager/DevicePrint.cpp | 4 +- .../src/DeviceManager/DeviceStorage.cpp | 82 +- .../src/GenerateDevice/CmdTool.cpp | 31 +- .../src/GenerateDevice/DeviceGenerator.cpp | 119 ++- .../src/GenerateDevice/HWGenerator.cpp | 392 +++----- .../src/GenerateDevice/HWGenerator.h | 15 - deepin-devicemanager/src/Page/MainWindow.cpp | 6 + deepin-devicemanager/src/commonfunction.cpp | 12 +- deepin-devicemanager/src/commonfunction.h | 3 + deepin-devicemanager/src/main.cpp | 3 +- .../deepin-devicemanager_zh_CN.ts | 922 ++++++++---------- 30 files changed, 928 insertions(+), 1093 deletions(-) diff --git a/deepin-devicemanager/assets/oeminfo_sampleAnduseGuideLine_zh_CN.toml b/deepin-devicemanager/assets/oeminfo_sampleAnduseGuideLine_zh_CN.toml index abcd1460a..0afc0cc52 100755 --- a/deepin-devicemanager/assets/oeminfo_sampleAnduseGuideLine_zh_CN.toml +++ b/deepin-devicemanager/assets/oeminfo_sampleAnduseGuideLine_zh_CN.toml @@ -501,4 +501,6 @@ Device File ="toml_Device File" #10 : 设备文件 #4-3-2.双匹配key需要两个值同时匹配:key2:"Vendor_ID 和 Product_ID"("物理ID"中VID和PID值); key3:"Vendor 和 Name"(制造商和名称); 。 #4-4.匹配生效后表头下面每行key名与对应设备管理器中显示每条信息名一致,其值则会被显示到对应界面。 #4-3.若匹配key匹配上某一设备且值尾包括有"_NOUSE"则该个设备所有信息将被删除显示。 -#4-4.增加一个设备信息则不需要匹配;没有写入该文件的表头所代表设备将不会被修改;没有写入该文件的key值所代表设备信息将不会被修改。 \ No newline at end of file +#4-4.增加一个设备信息则不需要匹配;没有写入该文件的表头所代表设备将不会被修改;没有写入该文件的key值所代表设备信息将不会被修改。 +#4-5.1 增加 tomlmatchkey = { Size = "512", Name = "xname" } # 内联表 "{Size:512G}{Name:xx1}{Vendor:xx2}" # 匹配键名 +#4-5.2 增加 tomlconfigdemanding ="adjust" # 配置需求 “adjust delete add” diff --git a/deepin-devicemanager/assets/org.deepin.devicemanager.json b/deepin-devicemanager/assets/org.deepin.devicemanager.json index cbc0690f8..ee5975fb1 100644 --- a/deepin-devicemanager/assets/org.deepin.devicemanager.json +++ b/deepin-devicemanager/assets/org.deepin.devicemanager.json @@ -15,7 +15,7 @@ "permissions": "readwrite", "visibility": "public" }, - "specialComType": { + "specialComType": { "value": -1, "serial": 0, "flags": ["global"], @@ -24,6 +24,16 @@ "description": "special computer type:PGUW(value:1),KLVV/L540(value:2),KLVU(value:3),PGUV/W585(value:4),PGUX(value:5)", "permissions": "readwrite", "visibility": "private" - } - } -} + }, + "TomlFilesName": { + "value": "tomlFilesName", + "serial": 0, + "flags": ["global"], + "name": "config the toml name", + "name[zh_CN]": "设置toml文件名", + "description": "此配置项默认为无效的。如需让toml文件内容显示生效,请配置对应文件名。需保证操作者具备读取权限。", + "permissions": "readwrite", + "visibility": "private" + } + } +} \ No newline at end of file diff --git a/deepin-devicemanager/src/DeviceManager/DeviceAudio.cpp b/deepin-devicemanager/src/DeviceManager/DeviceAudio.cpp index 30ecd8a4f..ad43778b4 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceAudio.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceAudio.cpp @@ -359,11 +359,11 @@ void DeviceAudio::loadTableData() QString tName = m_Name; if (!available()) { - tName = "(" + tr("Unavailable") + ") " + m_Name; + tName = "(" + translateStr("Unavailable") + ") " + m_Name; } if (!enable()) { - tName = "(" + tr("Disable") + ") " + m_Name; + tName = "(" + translateStr("Disable") + ") " + m_Name; } m_TableData.append(tName); diff --git a/deepin-devicemanager/src/DeviceManager/DeviceBios.cpp b/deepin-devicemanager/src/DeviceManager/DeviceBios.cpp index 3a8613b33..26ce6a7e1 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceBios.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceBios.cpp @@ -157,7 +157,7 @@ bool DeviceBios::isBoard()const QString DeviceBios::subTitle() { - return QObject::tr(m_Name.toLatin1()); + return translateStr(m_Name); } const QString DeviceBios::getOverviewInfo() diff --git a/deepin-devicemanager/src/DeviceManager/DeviceBluetooth.cpp b/deepin-devicemanager/src/DeviceManager/DeviceBluetooth.cpp index 1dd0a01c4..3a5654d7c 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceBluetooth.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceBluetooth.cpp @@ -134,24 +134,6 @@ TomlFixMethod DeviceBluetooth::setInfoFromTomlOneByOne(const QMap &mapInfo) -{ - // 机器自身蓝牙 - const QList > &otherAttribs = getOtherAttribs(); - QMap tmpMaps; - for (QPair attrib : otherAttribs) { - tmpMaps[attrib.first] = attrib.second; - } - - if ("UART" == tmpMaps[QObject::tr("Bus")]) {//内置:UART 外接USB:USB - setAttribute(mapInfo, "Chip Type", m_Name); - setAttribute(mapInfo, "Vendor", m_Vendor); - return true; - } else { - return false; - } -} - const QString &DeviceBluetooth::name()const { return m_Model; @@ -268,11 +250,11 @@ void DeviceBluetooth::loadTableData() QString tName = m_Name; if (!available()) { - tName = "(" + tr("Unavailable") + ") " + m_Name; + tName = "(" + translateStr("Unavailable") + ") " + m_Name; } if (!enable()) { - tName = "(" + tr("Disable") + ") " + m_Name; + tName = "(" + translateStr("Disable") + ") " + m_Name; } m_TableData.append(tName); diff --git a/deepin-devicemanager/src/DeviceManager/DeviceBluetooth.h b/deepin-devicemanager/src/DeviceManager/DeviceBluetooth.h index 68e0a9665..5480bac6f 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceBluetooth.h +++ b/deepin-devicemanager/src/DeviceManager/DeviceBluetooth.h @@ -45,13 +45,6 @@ class DeviceBluetooth : public DeviceBaseInfo */ TomlFixMethod setInfoFromTomlOneByOne(const QMap &mapInfo); - /** - * @brief setInfoFromWifiInfo:设置从cat /sys/hisys/wal/wifi_devices_info里面获取的信息 - * @param mapInfo: 由cat /sys/hisys/wal/wifi_devices_info获取的信息map - * @return 布尔值,true:信息设置成功;false:信息设置失败 - */ - bool setInfoFromWifiInfo(const QMap &mapInfo); - /** * @brief name:获取名称属性值 * @return QString:名称属性值 diff --git a/deepin-devicemanager/src/DeviceManager/DeviceCdrom.cpp b/deepin-devicemanager/src/DeviceManager/DeviceCdrom.cpp index b93c0005f..2ac00a7a7 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceCdrom.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceCdrom.cpp @@ -150,11 +150,11 @@ void DeviceCdrom::loadTableData() QString tName = m_Name; if (!available()) { - tName = "(" + tr("Unavailable") + ") " + m_Name; + tName = "(" + translateStr("Unavailable") + ") " + m_Name; } if (!enable()) { - tName = "(" + tr("Disable") + ") " + m_Name; + tName = "(" + translateStr("Disable") + ") " + m_Name; } m_TableData.append(tName); diff --git a/deepin-devicemanager/src/DeviceManager/DeviceCpu.cpp b/deepin-devicemanager/src/DeviceManager/DeviceCpu.cpp index d80787613..be8846aa9 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceCpu.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceCpu.cpp @@ -104,7 +104,7 @@ bool DeviceCpu::frequencyIsRange()const QString DeviceCpu::subTitle() { - return QString("%1 %2").arg(QObject::tr("Processor")).arg(m_PhysicalID); + return QString("%1 %2").arg(translateStr("Processor")).arg(m_PhysicalID); } const QString DeviceCpu::getOverviewInfo() @@ -115,9 +115,9 @@ const QString DeviceCpu::getOverviewInfo() QString ov = QString("%1 (%2%3 / %4%5)") \ .arg(m_Name) \ .arg(m_trNumber[m_CPUCoreNum]) \ - .arg(QObject::tr("Core(s)")) \ + .arg(translateStr("Core(s)")) \ .arg(m_trNumber[m_LogicalCPUNum]) \ - .arg(QObject::tr("Processor")); + .arg(translateStr("Processor")); return ov; } @@ -302,85 +302,85 @@ void DeviceCpu::loadTableData() void DeviceCpu::getTrNumber() { // 将数字转换为英文翻译 - m_trNumber.insert(1, QObject::tr("One")); - m_trNumber.insert(2, QObject::tr("Two")); - m_trNumber.insert(4, QObject::tr("Four")); - m_trNumber.insert(6, QObject::tr("Six")); - m_trNumber.insert(8, QObject::tr("Eight")); - m_trNumber.insert(9, QObject::tr("Nine")); - m_trNumber.insert(10, QObject::tr("Ten")); - m_trNumber.insert(12, QObject::tr("Twelve")); - m_trNumber.insert(14, QObject::tr("Fourteen")); - m_trNumber.insert(16, QObject::tr("Sixteen")); - m_trNumber.insert(18, QObject::tr("Eighteen")); - - m_trNumber.insert(20, QObject::tr("Twenty")); - m_trNumber.insert(22, QObject::tr("Twenty-two")); - m_trNumber.insert(24, QObject::tr("Twenty-four")); - m_trNumber.insert(26, QObject::tr("Twenty-six")); - m_trNumber.insert(28, QObject::tr("Twenty-eight")); - - m_trNumber.insert(30, QObject::tr("Thirty")); - m_trNumber.insert(32, QObject::tr("Thirty-two")); - m_trNumber.insert(34, QObject::tr("Thirty-four")); - m_trNumber.insert(36, QObject::tr("Thirty-six")); - m_trNumber.insert(38, QObject::tr("Thirty-eight")); - - m_trNumber.insert(40, QObject::tr("Forty")); - m_trNumber.insert(42, QObject::tr("Forty-two")); - m_trNumber.insert(44, QObject::tr("Forty-four")); - m_trNumber.insert(46, QObject::tr("Forty-six")); - m_trNumber.insert(48, QObject::tr("Forty-eight")); - - m_trNumber.insert(50, QObject::tr("Fifty")); - m_trNumber.insert(52, QObject::tr("Fifty-two")); - m_trNumber.insert(54, QObject::tr("Fifty-four")); - m_trNumber.insert(56, QObject::tr("Fifty-six")); - m_trNumber.insert(58, QObject::tr("Fifty-eight")); - - m_trNumber.insert(60, QObject::tr("Sixty")); - m_trNumber.insert(62, QObject::tr("Sixty-two")); - m_trNumber.insert(64, QObject::tr("Sixty-four")); - m_trNumber.insert(66, QObject::tr("Sixty-six")); - m_trNumber.insert(68, QObject::tr("Sixty-eight")); - - m_trNumber.insert(70, QObject::tr("Seventy")); - m_trNumber.insert(72, QObject::tr("Seventy-two")); - m_trNumber.insert(74, QObject::tr("Seventy-four")); - m_trNumber.insert(76, QObject::tr("Seventy-six")); - m_trNumber.insert(78, QObject::tr("Seventy-eight")); - - m_trNumber.insert(80, QObject::tr("Eighty")); - m_trNumber.insert(82, QObject::tr("Eighty-two")); - m_trNumber.insert(84, QObject::tr("Eighty-four")); - m_trNumber.insert(86, QObject::tr("Eighty-six")); - m_trNumber.insert(88, QObject::tr("Eighty-eight")); - - m_trNumber.insert(90, QObject::tr("Ninety")); - m_trNumber.insert(92, QObject::tr("Ninety-two")); - m_trNumber.insert(94, QObject::tr("Ninety-four")); - m_trNumber.insert(96, QObject::tr("Ninety-six")); - m_trNumber.insert(98, QObject::tr("Ninety-eight")); - - m_trNumber.insert(100, QObject::tr("One hundred")); - m_trNumber.insert(102, QObject::tr("One hundred and Two")); - m_trNumber.insert(104, QObject::tr("One hundred and four")); - m_trNumber.insert(106, QObject::tr("One hundred and Six")); - m_trNumber.insert(108, QObject::tr("One hundred and Eight")); - - m_trNumber.insert(110, QObject::tr("One hundred and Ten")); - m_trNumber.insert(112, QObject::tr("One hundred and Twelve")); - m_trNumber.insert(114, QObject::tr("One hundred and Fourteen")); - m_trNumber.insert(116, QObject::tr("One hundred and Sixteen")); - m_trNumber.insert(118, QObject::tr("One hundred and Eighteen")); - - m_trNumber.insert(120, QObject::tr("One hundred and Twenty")); - m_trNumber.insert(122, QObject::tr("One hundred and Twenty-two")); - m_trNumber.insert(124, QObject::tr("One hundred and Twenty-four")); - m_trNumber.insert(126, QObject::tr("One hundred and Twenty-six")); - m_trNumber.insert(128, QObject::tr("One hundred and Twenty-eight")); - m_trNumber.insert(192, QObject::tr("One hundred and Ninety-two")); - m_trNumber.insert(256, QObject::tr("Two hundred and fifty-six")); + m_trNumber.insert(1, translateStr("One")); + m_trNumber.insert(2, translateStr("Two")); + m_trNumber.insert(4, translateStr("Four")); + m_trNumber.insert(6, translateStr("Six")); + m_trNumber.insert(8, translateStr("Eight")); + m_trNumber.insert(9, translateStr("Nine")); + m_trNumber.insert(10, translateStr("Ten")); + m_trNumber.insert(12, translateStr("Twelve")); + m_trNumber.insert(14, translateStr("Fourteen")); + m_trNumber.insert(16, translateStr("Sixteen")); + m_trNumber.insert(18, translateStr("Eighteen")); + + m_trNumber.insert(20, translateStr("Twenty")); + m_trNumber.insert(22, translateStr("Twenty-two")); + m_trNumber.insert(24, translateStr("Twenty-four")); + m_trNumber.insert(26, translateStr("Twenty-six")); + m_trNumber.insert(28, translateStr("Twenty-eight")); + + m_trNumber.insert(30, translateStr("Thirty")); + m_trNumber.insert(32, translateStr("Thirty-two")); + m_trNumber.insert(34, translateStr("Thirty-four")); + m_trNumber.insert(36, translateStr("Thirty-six")); + m_trNumber.insert(38, translateStr("Thirty-eight")); + + m_trNumber.insert(40, translateStr("Forty")); + m_trNumber.insert(42, translateStr("Forty-two")); + m_trNumber.insert(44, translateStr("Forty-four")); + m_trNumber.insert(46, translateStr("Forty-six")); + m_trNumber.insert(48, translateStr("Forty-eight")); + + m_trNumber.insert(50, translateStr("Fifty")); + m_trNumber.insert(52, translateStr("Fifty-two")); + m_trNumber.insert(54, translateStr("Fifty-four")); + m_trNumber.insert(56, translateStr("Fifty-six")); + m_trNumber.insert(58, translateStr("Fifty-eight")); + + m_trNumber.insert(60, translateStr("Sixty")); + m_trNumber.insert(62, translateStr("Sixty-two")); + m_trNumber.insert(64, translateStr("Sixty-four")); + m_trNumber.insert(66, translateStr("Sixty-six")); + m_trNumber.insert(68, translateStr("Sixty-eight")); + + m_trNumber.insert(70, translateStr("Seventy")); + m_trNumber.insert(72, translateStr("Seventy-two")); + m_trNumber.insert(74, translateStr("Seventy-four")); + m_trNumber.insert(76, translateStr("Seventy-six")); + m_trNumber.insert(78, translateStr("Seventy-eight")); + + m_trNumber.insert(80, translateStr("Eighty")); + m_trNumber.insert(82, translateStr("Eighty-two")); + m_trNumber.insert(84, translateStr("Eighty-four")); + m_trNumber.insert(86, translateStr("Eighty-six")); + m_trNumber.insert(88, translateStr("Eighty-eight")); + + m_trNumber.insert(90, translateStr("Ninety")); + m_trNumber.insert(92, translateStr("Ninety-two")); + m_trNumber.insert(94, translateStr("Ninety-four")); + m_trNumber.insert(96, translateStr("Ninety-six")); + m_trNumber.insert(98, translateStr("Ninety-eight")); + + m_trNumber.insert(100, translateStr("One hundred")); + m_trNumber.insert(102, translateStr("One hundred and Two")); + m_trNumber.insert(104, translateStr("One hundred and four")); + m_trNumber.insert(106, translateStr("One hundred and Six")); + m_trNumber.insert(108, translateStr("One hundred and Eight")); + + m_trNumber.insert(110, translateStr("One hundred and Ten")); + m_trNumber.insert(112, translateStr("One hundred and Twelve")); + m_trNumber.insert(114, translateStr("One hundred and Fourteen")); + m_trNumber.insert(116, translateStr("One hundred and Sixteen")); + m_trNumber.insert(118, translateStr("One hundred and Eighteen")); + + m_trNumber.insert(120, translateStr("One hundred and Twenty")); + m_trNumber.insert(122, translateStr("One hundred and Twenty-two")); + m_trNumber.insert(124, translateStr("One hundred and Twenty-four")); + m_trNumber.insert(126, translateStr("One hundred and Twenty-six")); + m_trNumber.insert(128, translateStr("One hundred and Twenty-eight")); + m_trNumber.insert(192, translateStr("One hundred and Ninety-two")); + m_trNumber.insert(256, translateStr("Two hundred and fifty-six")); } diff --git a/deepin-devicemanager/src/DeviceManager/DeviceGpu.cpp b/deepin-devicemanager/src/DeviceManager/DeviceGpu.cpp index 841418fb4..84c320de1 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceGpu.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceGpu.cpp @@ -348,7 +348,7 @@ void DeviceGpu::loadTableData() // 加载表格内容 QString tName = m_Name; if (!available()) { - tName = "(" + tr("Unavailable") + ") " + m_Name; + tName = "(" + translateStr("Unavailable") + ") " + m_Name; } m_TableData.append(tName); m_TableData.append(m_Vendor); diff --git a/deepin-devicemanager/src/DeviceManager/DeviceImage.cpp b/deepin-devicemanager/src/DeviceManager/DeviceImage.cpp index 324af8a6e..871a26947 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceImage.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceImage.cpp @@ -189,11 +189,11 @@ void DeviceImage::loadTableData() QString tName = m_Name; if (!available()) { - tName = "(" + tr("Unavailable") + ") " + m_Name; + tName = "(" + translateStr("Unavailable") + ") " + m_Name; } if (!enable()) { - tName = "(" + tr("Disable") + ") " + m_Name; + tName = "(" + translateStr("Disable") + ") " + m_Name; } m_TableData.append(tName); diff --git a/deepin-devicemanager/src/DeviceManager/DeviceInfo.cpp b/deepin-devicemanager/src/DeviceManager/DeviceInfo.cpp index 661abbdff..4ff8f5960 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceInfo.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceInfo.cpp @@ -127,8 +127,8 @@ const QStringList &DeviceBaseInfo::getTableData() loadTableData(); m_TableDataTr.clear(); for (const auto &item : m_TableData) { - QString trKey = translateStr(item); - if(trKey.isEmpty()) + QString trKey = (item); + if (trKey.isEmpty()) m_TableDataTr.append(item); else m_TableDataTr.append(trKey); @@ -147,7 +147,7 @@ bool DeviceBaseInfo::isValueValid(QString &value) if (value.isEmpty()) return false; - if (value == QObject::tr("Unknown")) + if (value == translateStr("Unknown")) return false; if (value == QString("Unknown")) @@ -633,7 +633,7 @@ const QString DeviceBaseInfo::getVendorOrModelId(const QString &sysPath, bool fl const QString DeviceBaseInfo::getDriverVersion() { QString outInfo = Common::executeClientCmd("modinfo", QStringList() << driver(), QString(), -1); - if(outInfo.isEmpty()) + if (outInfo.isEmpty()) return QString(""); foreach (QString out, outInfo.split("\n")) { @@ -728,7 +728,7 @@ const QString DeviceBaseInfo::readDeviceInfoKeyValue(const QString &key) } QList > allOtherAttribs = getOtherAttribs(); for (const QPair& pair : allOtherAttribs) { - if (key == key) + if (key == pair.first) return pair.second; } return QString(""); diff --git a/deepin-devicemanager/src/DeviceManager/DeviceInput.cpp b/deepin-devicemanager/src/DeviceManager/DeviceInput.cpp index 207e281e1..fccc4ce66 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceInput.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceInput.cpp @@ -460,11 +460,11 @@ void DeviceInput::loadTableData() QString tName = m_Name; if (!available()) { - tName = "(" + tr("Unavailable") + ") " + m_Name; + tName = "(" + translateStr("Unavailable") + ") " + m_Name; } if (!enable()) { - tName = "(" + tr("Disable") + ") " + m_Name; + tName = "(" + translateStr("Disable") + ") " + m_Name; } m_TableData.append(tName); diff --git a/deepin-devicemanager/src/DeviceManager/DeviceManager.cpp b/deepin-devicemanager/src/DeviceManager/DeviceManager.cpp index f3f43b333..8fd576ac4 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceManager.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceManager.cpp @@ -558,6 +558,43 @@ QString DeviceManager::tomlDeviceReadKeyValue(DeviceType deviceType, DeviceBaseI return QString(""); } +bool DeviceManager::tomlSetBytomlmatchkey(DeviceType deviceType, DeviceBaseInfo *device, const QString &tomltomlmatchkey, const QString &tomltomlconfigdemanding) +{ + Q_UNUSED(deviceType) + QMap itemMap; + QStringList keyValues = tomltomlmatchkey.split(","); + foreach (const QString &keyValue, keyValues) { + QStringList wordlst = keyValue.split("="); + if (2 == wordlst.size()) { + + QString key = wordlst[0].remove('"').trimmed(); + QString valuetmp = wordlst[1]; + QStringList valuelst; + QString value; + if (valuetmp.contains("#")) { + valuelst = valuetmp.split("#"); + value = valuelst[0].remove('\"').trimmed(); + } else + value = valuetmp.remove('\"').trimmed(); + + itemMap.insert(key, value); + } + } + if(itemMap.size() == 0 ) + return false; + + for (auto key : itemMap.keys()) { + QString tomlKey = key; + QString tomlVal = itemMap.value(key); + QString deviceVal = device->readDeviceInfoKeyValue(tomlKey); + if((0 != deviceVal.compare(tomlVal, Qt::CaseInsensitive))) { + return false; + } + } + + return true; +} + void DeviceManager::tomlDeviceSet(DeviceType deviceType) { @@ -565,7 +602,9 @@ void DeviceManager::tomlDeviceSet(DeviceType deviceType) const QList> &tomlMapLst = cmdInfo(deviceTypeName); for (int j = 0; j < tomlMapLst.size(); j++) { // 加载从toml中获取的信息 bool fixSameOne = false; //初始值设为该项信息没有用过 - bool isSameOne = false; + + QString tomltomlmatchkey = tomlMapLst[j]["tomlmatchkey"]; + QString tomltomlconfigdemanding = PhysID(tomlMapLst[j], "tomlconfigdemanding"); QList lst = convertDeviceList(deviceType); for (int i = 0; i < lst.size(); i++) { // toml中获取的信息 与 原设备信息遍历,相比较作处理 DeviceBaseInfo *device = lst[i]; @@ -574,27 +613,53 @@ void DeviceManager::tomlDeviceSet(DeviceType deviceType) QString pid = PhysID(tomlMapLst[j], "Product_ID"); QString vendor = PhysID(tomlMapLst[j], "Vendor"); QString name = PhysID(tomlMapLst[j], "Name"); - //取出toml中获取的关键字信息设备唯一标识硬件IDS "Modalias", "Vendor_ID", "Vendor","Name";作比较处理 - isSameOne = findByModalias(deviceType, device, modalias); - if (!isSameOne) { - isSameOne = findByVIDPID(deviceType, device, vid, pid); - } - if (!isSameOne) { - isSameOne = findByVendorName(deviceType, device, vendor, name); - } - if (isSameOne) { //存在 就合并信息 setInfoFromTomlOneByOne(const QMap &mapInfo); + bool isSameOne = false; //初始值设为该项信息不属于该设备 + + + isSameOne = tomlSetBytomlmatchkey(deviceType, device, tomltomlmatchkey,tomltomlconfigdemanding); + + if (tomltomlconfigdemanding == "adjust") { + fixSameOne = true; //标记为该项信息有用过 , + if (isSameOne) + tomlDeviceMapSet(deviceType, device, tomlMapLst[j]); + } else if (tomltomlconfigdemanding == "delete") { fixSameOne = true; //标记为该项信息有用过 , - if (TOML_Del == tomlDeviceMapSet(deviceType, device, tomlMapLst[j])) { + if (isSameOne) { tomlDeviceDel(deviceType, device); //toml 去掉该设备 delete (device); } + } else if (tomltomlconfigdemanding == "add" && !fixSameOne) { + + } else { + //取出toml中获取的关键字信息设备唯一标识硬件IDS "Modalias", "Vendor_ID", "Vendor","Name";作比较处理 + if (!isSameOne) + isSameOne = findByModalias(deviceType, device, modalias); + if (!isSameOne) { + isSameOne = findByVIDPID(deviceType, device, vid, pid); + } + if (!isSameOne) { + isSameOne = findByVendorName(deviceType, device, vendor, name); + } + if (isSameOne&& !fixSameOne) { //存在 就合并信息 + fixSameOne = true; //标记为该项信息有用过 , + if (TOML_Del == tomlDeviceMapSet(deviceType, device, tomlMapLst[j])) { + tomlDeviceDel(deviceType, device); //toml 去掉该设备 + delete (device); + } + } } } //与原设备信息遍历相比完再作添加设备 - if ((deviceType != DT_Bios) && (deviceType != DT_Computer) && !fixSameOne) { - fixSameOne = true; //标记为该项信息有用过 ,则不再增加了 - DeviceBaseInfo *device = createDevice(deviceType); - tomlDeviceMapSet(deviceType, device, tomlMapLst[j]); - tomlDeviceAdd(deviceType, device); //不存在 就加 + + if (tomltomlconfigdemanding == "add" && !fixSameOne) { + fixSameOne = true; //标记为该项信息有用过 + DeviceBaseInfo *newDevice = createDevice(deviceType); + tomlDeviceMapSet(deviceType, newDevice, tomlMapLst[j]); + tomlDeviceAdd(deviceType, newDevice); //加 + } else if ((deviceType != DT_Bios) && (deviceType != DT_Computer) && !fixSameOne) { + fixSameOne = true; //标记为该项信息有用过 ,则不再增加了 + DeviceBaseInfo *device = createDevice(deviceType); + tomlDeviceMapSet(deviceType, device, tomlMapLst[j]); + tomlDeviceAdd(deviceType, device); //不存在 就加 } } //end of for (int j = 0;... } @@ -1023,18 +1088,6 @@ bool DeviceManager::setBluetoothInfoFromHwinfo(const QMap &map return false; } -bool DeviceManager::setBluetoothInfoFromWifiInfo(const QMap &mapInfo) -{ - QList::iterator it = m_ListDeviceBluetooth.begin(); - for (; it != m_ListDeviceBluetooth.end(); ++it) { - DeviceBluetooth *device = dynamic_cast(*it); - if (device->setInfoFromWifiInfo(mapInfo)) { - return true; - } - } - return false; -} - DeviceBaseInfo *DeviceManager::getBluetoothDevice(const QString &unique_id) { for (QList::iterator it = m_ListDeviceBluetooth.begin(); it != m_ListDeviceBluetooth.end(); ++it) { @@ -1136,22 +1189,6 @@ void DeviceManager::addNetworkDevice(DeviceNetwork *const device) m_ListDeviceNetwork.append(device); } -bool DeviceManager::setNetworkInfoFromWifiInfo(const QMap &mapInfo) -{ - QList::iterator it = m_ListDeviceNetwork.begin(); - for (; it != m_ListDeviceNetwork.end(); ++it) { - - DeviceNetwork *device = dynamic_cast(*it); - if (!device) - continue; - - if (device->setInfoFromWifiInfo(mapInfo)) { - return true; - } - } - return false; -} - DeviceBaseInfo *DeviceManager::getNetworkDevice(const QString &unique_id) { for (QList::iterator it = m_ListDeviceNetwork.begin(); it != m_ListDeviceNetwork.end(); ++it) { diff --git a/deepin-devicemanager/src/DeviceManager/DeviceManager.h b/deepin-devicemanager/src/DeviceManager/DeviceManager.h index 0b2ebb7d3..a2682366b 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceManager.h +++ b/deepin-devicemanager/src/DeviceManager/DeviceManager.h @@ -108,7 +108,7 @@ class DeviceManager : public QObject void tomlDeviceDel(DeviceType deviceType, DeviceBaseInfo *const device); void tomlDeviceAdd(DeviceType deviceType, DeviceBaseInfo *const device); QString tomlDeviceReadKeyValue(DeviceType deviceType, DeviceBaseInfo *device, const QString &key); - + bool tomlSetBytomlmatchkey(DeviceType deviceType, DeviceBaseInfo *device, const QString &tomltomlmatchkey, const QString &tomltomlconfigdemanding); /** * @brief * toml 方案内容定义: @@ -131,14 +131,12 @@ class DeviceManager : public QObject * @param KeyID "Module Alias" "VID_PID" * @return */ - DeviceBaseInfo *findByModalias(DeviceType deviceType, const QString &modalias); - DeviceBaseInfo *findByVIDPID(DeviceType deviceType, const QString &vid, const QString &pid); - DeviceBaseInfo *findByVendorName(DeviceType deviceType, const QString &vendor, const QString &name); bool findByModalias(DeviceType deviceType, DeviceBaseInfo *device, const QString &modalias); bool findByVIDPID(DeviceType deviceType, DeviceBaseInfo *device, const QString &vid, const QString &pid); bool findByVendorName(DeviceType deviceType, DeviceBaseInfo *device, const QString &vendor, const QString &name); + /** * @brief getBluetoothAtIndex 根据索引获取device * @param index @@ -306,13 +304,6 @@ class DeviceManager : public QObject */ bool setBluetoothInfoFromHwinfo(const QMap &mapInfo); - /** - * @brief setBluetoothInfoFromWifiInfo:设置由WifiInfo获取的蓝牙信息 - * @param mapInfo:由WifiInfo获取的蓝牙信息map - * @return 布尔值:true设置成功;false设置失败 - */ - bool setBluetoothInfoFromWifiInfo(const QMap &mapInfo); - /** * @brief getBluetoothDevice * @param unique_id @@ -378,12 +369,6 @@ class DeviceManager : public QObject */ void addNetworkDevice(DeviceNetwork *const device); - /** - * @brief setNetworkInfoFromWifiInfo:设置网络适配器 - * @param mapInfo:由WifiInfo获取的网卡信息map - */ - bool setNetworkInfoFromWifiInfo(const QMap &mapInfo); - /** * @brief getNetworkDevice 获取网卡设备 * @param busInfo diff --git a/deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp b/deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp index c84ddf2c1..855474618 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp @@ -60,7 +60,7 @@ QString DeviceMonitor::parseMonitorSize(const QString &sizeDescription, double & double width = m_Width / 2.54; double height = m_Height / 2.54; inch = std::sqrt(width * width + height * height) / 10.0; - res = QString::number(inch, 10, 1) + " " + QObject::tr("inch") + " ("; + res = QString::number(inch, 10, 1) + " " + translateStr("inch") + " ("; res += sizeDescription; res += ")"; } @@ -77,7 +77,7 @@ QString DeviceMonitor::parseMonitorSize(const QString &sizeDescription, double & double width = m_Width / 2.54; double height = m_Height / 2.54; inch = std::sqrt(width * width + height * height) / 10.0; - res = QString::number(inch, 10, 1) + " " + QObject::tr("inch") + " ("; + res = QString::number(inch, 10, 1) + " " + translateStr("inch") + " ("; res += sizeDescription; res += ")"; } @@ -381,7 +381,7 @@ void DeviceMonitor::caculateScreenSize() m_Height = re.cap(2).toInt(); double inch = std::sqrt((m_Width / 2.54) * (m_Width / 2.54) + (m_Height / 2.54) * (m_Height / 2.54)) / 10.0; - m_ScreenSize = QString("%1 %2(%3mm X %4mm)").arg(QString::number(inch, '0', 1)).arg(QObject::tr("inch")).arg(m_Width).arg(m_Height); + m_ScreenSize = QString("%1 %2(%3mm X %4mm)").arg(QString::number(inch, '0', 1)).arg(translateStr("inch")).arg(m_Width).arg(m_Height); } } diff --git a/deepin-devicemanager/src/DeviceManager/DeviceNetwork.cpp b/deepin-devicemanager/src/DeviceManager/DeviceNetwork.cpp index b512df183..27fbe40f5 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceNetwork.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceNetwork.cpp @@ -46,11 +46,6 @@ DeviceNetwork::DeviceNetwork() void DeviceNetwork::setInfoFromLshw(const QMap &mapInfo) { - if (!matchToLshw(mapInfo) - && Common::boardVendorType() != "KLVV" && Common::boardVendorType() != "KLVU" - && Common::boardVendorType() != "PGUW" && Common::boardVendorType() != "PGUV") { - return; - } // 设置由lshw获取的信息 setAttribute(mapInfo, "description", m_Model); setAttribute(mapInfo, "product", m_Name); @@ -185,20 +180,6 @@ bool DeviceNetwork::setInfoFromHwinfo(const QMap &mapInfo) return true; } -bool DeviceNetwork::setInfoFromWifiInfo(const QMap &mapInfo) -{ - // 机器自身蓝牙 - if (m_Name.contains(Common::specialHString(), Qt::CaseInsensitive)) { - setAttribute(mapInfo, "Chip Type", m_Name); - setAttribute(mapInfo, "Vendor", m_Vendor); - setAttribute(mapInfo, "Type", m_Model); - - return true; - } else { - return false; - } -} - void DeviceNetwork::setIsWireless(const QString &sysfs) { // 路径下包含 phy80211 或 wireless 是无线网卡 @@ -341,11 +322,11 @@ void DeviceNetwork::loadTableData() QString tName = m_Name; if (!available()) { - tName = "(" + tr("Unavailable") + ") " + m_Name; + tName = "(" + translateStr("Unavailable") + ") " + m_Name; } if (!enable()) { - tName = "(" + tr("Disable") + ") " + m_Name; + tName = "(" + translateStr("Disable") + ") " + m_Name; } // 加载表格数据信息 diff --git a/deepin-devicemanager/src/DeviceManager/DeviceNetwork.h b/deepin-devicemanager/src/DeviceManager/DeviceNetwork.h index 5e02a2183..6b050289a 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceNetwork.h +++ b/deepin-devicemanager/src/DeviceManager/DeviceNetwork.h @@ -39,13 +39,6 @@ class DeviceNetwork : public DeviceBaseInfo */ bool setInfoFromHwinfo(const QMap &mapInfo); - /** - * @brief setInfoFromWifiInfo:设置从cat /sys/hisys/wal/wifi_devices_info里面获取的信息 - * @param mapInfo: 由cat /sys/hisys/wal/wifi_devices_info获取的信息map - * @return 布尔值,true:信息设置成功;false:信息设置失败 - */ - bool setInfoFromWifiInfo(const QMap &mapInfo); - /** * @brief setIsWireless: 设置是否是无线网 * @param sysFSID: SysFS ID: /class/net/enp2s0 diff --git a/deepin-devicemanager/src/DeviceManager/DeviceOthers.cpp b/deepin-devicemanager/src/DeviceManager/DeviceOthers.cpp index bf5956366..96e1b6486 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceOthers.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceOthers.cpp @@ -204,10 +204,10 @@ void DeviceOthers::loadTableData() // 加载表格数据 QString tName = m_Name; if (!available()) { - tName = "(" + tr("Unavailable") + ") " + m_Name; + tName = "(" + translateStr("Unavailable") + ") " + m_Name; } if (!enable()) { - tName = "(" + tr("Disable") + ") " + m_Name; + tName = "(" + translateStr("Disable") + ") " + m_Name; } m_TableData.append(tName); diff --git a/deepin-devicemanager/src/DeviceManager/DevicePower.cpp b/deepin-devicemanager/src/DeviceManager/DevicePower.cpp index 477bacf66..2146f2e96 100644 --- a/deepin-devicemanager/src/DeviceManager/DevicePower.cpp +++ b/deepin-devicemanager/src/DeviceManager/DevicePower.cpp @@ -69,7 +69,6 @@ bool DevicePower::setInfoFromUpower(const QMap &mapInfo) if (mapInfo["Device"].contains("line_power", Qt::CaseInsensitive)) { return false; } - // m_Name = QObject::tr("battery"); setAttribute(mapInfo, "", m_Vendor); setAttribute(mapInfo, "", m_Model); @@ -107,7 +106,7 @@ bool DevicePower::setInfoFromUpower(const QMap &mapInfo) void DevicePower::setDaemonInfo(const QMap &mapInfo) { // 设置守护进程信息 - if (m_Name == QObject::tr("battery")) + if (m_Name == translateStr("battery")) getOtherMapInfo(mapInfo); } diff --git a/deepin-devicemanager/src/DeviceManager/DevicePrint.cpp b/deepin-devicemanager/src/DeviceManager/DevicePrint.cpp index 63636b6fc..3fe00334f 100644 --- a/deepin-devicemanager/src/DeviceManager/DevicePrint.cpp +++ b/deepin-devicemanager/src/DeviceManager/DevicePrint.cpp @@ -160,7 +160,7 @@ void DevicePrint::loadOtherDeviceInfo() addOtherDeviceInfo(("URI"), m_URI); addOtherDeviceInfo(("Status"), m_Status); addOtherDeviceInfo(("Interface Type"), m_InterfaceType); - addOtherDeviceInfo(QObject::tr("printer-make-and-model"), m_MakeAndModel); + addOtherDeviceInfo(("printer-make-and-model"), m_MakeAndModel); // 将QMap内容转存为QList> mapInfoToList(); } @@ -170,7 +170,7 @@ void DevicePrint::loadTableData() // 加载表格数据 QString tName = m_Name; if (!enable()) { - tName = "(" + tr("Disable") + ") " + m_Name; + tName = "(" + translateStr("Disable") + ") " + m_Name; } m_TableData.append(tName); diff --git a/deepin-devicemanager/src/DeviceManager/DeviceStorage.cpp b/deepin-devicemanager/src/DeviceManager/DeviceStorage.cpp index 51089ba4b..3cefed1ed 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceStorage.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceStorage.cpp @@ -124,19 +124,6 @@ void DeviceStorage::unitConvertByDecimal() { if(m_SizeBytes > 0) m_Size = decimalkilos(m_SizeBytes); - - quint64 gbyte = 1000000000; - if (m_Interface.contains("UFS", Qt::CaseInsensitive)) { - if(m_SizeBytes > 255*gbyte && m_SizeBytes < 257*gbyte) { - m_Size = "256 GB"; - } else if(m_SizeBytes > 511*gbyte && m_SizeBytes < 513*gbyte) { - m_Size = "512 GB"; - } else if(m_SizeBytes > 999*gbyte && m_SizeBytes < 1025*gbyte) { - m_Size = "1 TB"; - } else if(m_SizeBytes > 1999*gbyte && m_SizeBytes < 2049*gbyte) { - m_Size = "2 TB"; - } - } } bool DeviceStorage::setHwinfoInfo(const QMap &mapInfo) @@ -355,11 +342,11 @@ bool DeviceStorage::setMediaType(const QString &name, const QString &value) return false; if (QString("0") == value) - m_MediaType = QObject::tr("SSD"); + m_MediaType = "SSD"; else if (QString("1") == value) - m_MediaType = QObject::tr("HDD"); + m_MediaType = "HDD"; else - m_MediaType = QObject::tr("Unknown"); + m_MediaType = "Unknown"; return true; } @@ -416,7 +403,7 @@ void DeviceStorage::appendDisk(DeviceStorage *device) } quint64 size2 = device->getDiskSizeByte(); - if(m_SizeBytes == 0) + if (m_SizeBytes == 0) m_SizeBytes = size2; else if (size2 > 0) { m_SizeBytes += size2; @@ -435,11 +422,10 @@ void DeviceStorage::appendDisk(DeviceStorage *device) } QStringList keyList; - keyList.append(QObject::tr("bus info")); - keyList.append(QObject::tr("Device File")); - // keyList.append(QObject::tr("physical id")); - keyList.append(QObject::tr("Device Number")); - keyList.append(QObject::tr("logical name")); + keyList.append(translateStr("bus info")); + keyList.append(translateStr("Device File")); + keyList.append(translateStr("Device Number")); + keyList.append(translateStr("logical name")); for (QString keyStr : keyList) { QString curBusInfo = curAllOtherAttribMaps[keyStr]; QString busInfo = allAttribMaps[keyStr]; @@ -453,16 +439,31 @@ void DeviceStorage::appendDisk(DeviceStorage *device) void DeviceStorage::checkDiskSize() { - QRegExp reg("[0-9]*.?[0-9]*"); - int index = reg.indexIn(m_Size); - // index>0时,对于"32GB"(数字开头的字符串,index=0)无法获取正确的数据32 - // 所以要改为index >= 0 - if (index >= 0) { - double num = reg.cap(0).toDouble(); - double num1 = num - int(num); - QString type = m_Size.right(m_Size.length() - reg.cap(0).size()).trimmed(); - if (!qFuzzyCompare(num1, 0.0) && type == "GB") { - m_Size = QString::number(int(num) + 1) + " " + type; + if (Common::specialVendorType() != Common::specialHString()) { + return; //定制机型专用,其它慎用 + } + + quint64 gbyte = 1000000000; + if (m_Interface.contains("UFS", Qt::CaseInsensitive)) { + if (m_SizeBytes > 255*gbyte && m_SizeBytes < 257*gbyte) { + m_Size = "256 GB"; + } else if (m_SizeBytes > 511*gbyte && m_SizeBytes < 513*gbyte) { + m_Size = "512 GB"; + } else if (m_SizeBytes > 999*gbyte && m_SizeBytes < 1025*gbyte) { + m_Size = "1 TB"; + } else if (m_SizeBytes > 1999*gbyte && m_SizeBytes < 2049*gbyte) { + m_Size = "2 TB"; + } + } + if (m_Interface.contains("USB", Qt::CaseInsensitive)) { + if (m_SizeBytes > 15*gbyte && m_SizeBytes < 17*gbyte) { + m_Size = "16 GB"; + } else if (m_SizeBytes > 31*gbyte && m_SizeBytes < 33*gbyte) { + m_Size = "32 GB"; + } else if (m_SizeBytes > 63*gbyte && m_SizeBytes < 65*gbyte) { + m_Size = "64 GB"; + } else if (m_SizeBytes > 127*gbyte && m_SizeBytes < 129*gbyte) { + m_Size = "128 GB"; } } } @@ -542,7 +543,7 @@ void DeviceStorage::loadBaseDeviceInfo() // 添加基本信息 addBaseDeviceInfo(("Name"), m_Name); addBaseDeviceInfo(("Vendor"), m_Vendor); - addBaseDeviceInfo(("Media Type"), m_MediaType); + addBaseDeviceInfo(("Media Type"), translateStr(m_MediaType)); addBaseDeviceInfo(("Size"), m_Size); addBaseDeviceInfo(("Version"), m_Version); addBaseDeviceInfo(("Capabilities"), m_Capabilities); @@ -572,7 +573,7 @@ void DeviceStorage::loadOtherDeviceInfo() addOtherDeviceInfo(("Physical ID"), m_PhysID); if (m_RotationRate == QString("Solid State Device")) { - m_MediaType = QObject::tr("SSD"); + m_MediaType = "SSD"; } // 将QMap内容转存为QList> @@ -597,7 +598,7 @@ void DeviceStorage::loadTableData() } m_TableData.append(model); m_TableData.append(m_Vendor); - m_TableData.append(m_MediaType); + m_TableData.append(translateStr(m_MediaType)); m_TableData.append(m_Size); } @@ -633,7 +634,7 @@ void DeviceStorage::getInfoFromsmartctl(const QMap &mapInfo) { if (mapInfo.size() < 5) { if (!mapInfo.isEmpty() && m_Interface.contains("USB", Qt::CaseInsensitive)) { - m_MediaType = QObject::tr("SSD"); + m_MediaType = "SSD"; } return; } @@ -648,12 +649,9 @@ void DeviceStorage::getInfoFromsmartctl(const QMap &mapInfo) setAttribute(mapInfo, "Rotation Rate", m_RotationRate); // 解决Bug45428,INTEL SSDSA2BW160G3L 这个型号的硬盘通过lsblk获取的rota是1,所以这里需要特殊处理 - if (m_RotationRate == QString("Solid State Device")) - m_MediaType = QObject::tr("SSD"); - - // 按照HW的需求,如果是固态硬盘就不显示转速 - if (m_RotationRate == QString("HW_SSD")) { - m_MediaType = QObject::tr("SSD"); + // 按照H的需求,如果是固态硬盘就不显示转速 + if (m_RotationRate == QString("Solid State Device")) { + m_MediaType = "SSD"; m_RotationRate = ""; } diff --git a/deepin-devicemanager/src/GenerateDevice/CmdTool.cpp b/deepin-devicemanager/src/GenerateDevice/CmdTool.cpp index 826d15196..98a62038d 100644 --- a/deepin-devicemanager/src/GenerateDevice/CmdTool.cpp +++ b/deepin-devicemanager/src/GenerateDevice/CmdTool.cpp @@ -7,6 +7,7 @@ #include #include #include "DDLog.h" +#include "commonfunction.h" // Qt库文件 #include @@ -204,6 +205,16 @@ bool CmdTool::parseOemTomlInfo(const QString filename) file.close(); } } + QString curPathFile2 = "/usr/share/deepin-devicemanager/" + filename; + if (QFile::exists(curPathFile2) && !tomlFileRead) { + QFile file(curPathFile2); + if (file.open(QIODevice::ReadOnly)) { + info = file.readAll().data(); + tomlFileRead = true; + file.close(); + } + } + if (!tomlFileRead) { curPathFile = "/etc/deepin/hardware/oeminfodebug.toml"; //方便调试,并不开放给用户用 QFile file(curPathFile); @@ -240,8 +251,18 @@ bool CmdTool::parseOemTomlInfo(const QString filename) itemMap.clear(); ValueKeyList.clear(); deviceClassesList.append(regClass.cap(2)); -// } else if (regKeyValue.exactMatch(line)) { //键值对= - } else if (line.contains("=")) { + } else if (line.contains("=") && line.contains("{") && line.contains("}")) { //内联表 + int start = line.indexOf("{") + 1; + int end = line.indexOf("}"); + QString value = line.mid(start, end - start).trimmed(); + wordlst = line.split("="); + if (2 <= wordlst.size()) { + QString key = wordlst[0].remove('"').trimmed(); + itemMap.insert(key, value); + ValueKeyList.append(key); + } + + } else if (line.contains("=")) { //键值对= wordlst = line.split("="); if (2 == wordlst.size()) { @@ -638,6 +659,12 @@ void CmdTool::loadDmidecodeInfo(const QString &key, const QString &debugfile) if (("dmidecode1" == key) && (mapInfo.size() > 0)) { QString filename = loadOemTomlFileName(mapInfo); parseOemTomlInfo(filename); + + QString tomlFilesName = Common::tomlFilesNameGet(); + if (!tomlFilesName.isEmpty() && tomlFilesName != "tomlFilesName") { + if (parseOemTomlInfo(tomlFilesName)) + qCInfo(appLog) << "config Toml File name is: /usr/share/deepin-devicemanager/" << tomlFilesName ; + } } // 过滤空cpu卡槽信息 diff --git a/deepin-devicemanager/src/GenerateDevice/DeviceGenerator.cpp b/deepin-devicemanager/src/GenerateDevice/DeviceGenerator.cpp index 0caccbad8..2eed3e0c7 100644 --- a/deepin-devicemanager/src/GenerateDevice/DeviceGenerator.cpp +++ b/deepin-devicemanager/src/GenerateDevice/DeviceGenerator.cpp @@ -32,6 +32,7 @@ // Qt库文件 #include #include +#include DeviceGenerator::DeviceGenerator(QObject *parent) : QObject(parent) @@ -245,85 +246,72 @@ void DeviceGenerator::generatorMonitorDevice() void DeviceGenerator::generatorNetworkDevice() { + bool hasWlan =false; QList lstDevice; - - QDir dir("/sys/class/net"); - // 获取所有的子目录 - QStringList subDirs = dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot); - - foreach (const QString &subDir, subDirs) { - if (subDir.contains("lo", Qt::CaseInsensitive) || subDir.contains("p2p", Qt::CaseInsensitive)) - continue; - - QString addressFilePath = dir.filePath(subDir + "/address"); - QFile addressFile(addressFilePath); - - // 尝试打开文件 - if (addressFile.open(QIODevice::ReadOnly | QIODevice::Text)) { - QTextStream in(&addressFile); - QString address = in.readLine(); // 读取内容 - qDebug() << "Interface:" << subDir << "Address:" << address; - if (address.length() == 17 - && !address.contains("00:00:00:00", Qt::CaseInsensitive) - && !address.contains("ff:ff:ff:ff", Qt::CaseInsensitive)) { - - DeviceNetwork *device = new DeviceNetwork(); - QMap tempMap; - tempMap["Logical Name"] = subDir; - tempMap["MAC Address"] = address; - DeviceManager::instance()->tomlDeviceMapSet(DT_Network, device,tempMap); - lstDevice.append(device); - } - addressFile.close(); - } else { - qDebug() << "Failed to open file:" << addressFilePath; - } - } - // 设置从lshw中获取的信息 const QList> &lstLshw = DeviceManager::instance()->cmdInfo("lshw_network"); for (QList >::const_iterator it = lstLshw.begin(); it != lstLshw.end(); ++it) { - if ((*it).find("serial") == (*it).end() && (*it).find("logical name") == (*it).end()) + if ((*it).find("serial") == (*it).end() || (*it).find("logical name") == (*it).end()) continue; - const QString &serialNumberLshw = (*it)["serial"]; const QString &logicalNameLshw = (*it)["logical name"]; - for (QList::iterator itDevice = lstDevice.begin(); itDevice != lstDevice.end(); ++itDevice) { - const QString &serialNumberLst = (*itDevice)->hwAddress(); - const QString &logicalNameLst = (*itDevice)->logicalName(); - if (serialNumberLshw == serialNumberLst || logicalNameLshw == logicalNameLst) { - (*itDevice)->setInfoFromLshw(*it); - } - } - } - - const QList> &lstHWInfo = DeviceManager::instance()->cmdInfo("hwinfo_network"); - for (QList >::const_iterator it = lstHWInfo.begin(); it != lstHWInfo.end(); ++it) { - - // 先判断是否是有效网卡信息 - // 符合两种情况中的一种 1. "HW Address" 和 "Permanent HW Address" 都必须有 2. 有 "unique_id" - if (((*it).find("HW Address") == (*it).end() && (*it).find("Permanent HW Address") == (*it).end()) && ((*it).find("unique_id") == (*it).end())) { + const QString &macAddressLshw = (*it)["serial"]; + if (logicalNameLshw.contains("p2p", Qt::CaseInsensitive)) continue; + if (logicalNameLshw.contains("wlan", Qt::CaseInsensitive) && hasWlan) //common sense: one PC only have 1 wlan device + continue; + if (macAddressLshw.contains("00:00:00:00:00:00", Qt::CaseInsensitive) || macAddressLshw.contains("ff:ff:ff:ff:ff:ff", Qt::CaseInsensitive) || macAddressLshw.isEmpty()) + continue; + // Regular expression for validating MAC address + QRegularExpression macRegex("([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})"); + if (!macRegex.match(macAddressLshw).hasMatch()) + continue; + + QString addressFilePath = "/sys/class/net/" + logicalNameLshw; + QDir dir(addressFilePath); + if (dir.exists()) { + DeviceNetwork *device = new DeviceNetwork(); + device->setInfoFromLshw(*it); + lstDevice.append(device); + if (logicalNameLshw.contains("wlan", Qt::CaseInsensitive)) + hasWlan = true; } - - const QString &serialNumberLshw = (*it)["HW Address"]; - const QString &logicalNameLshw = (*it)["Device File"]; - for (QList::iterator itDevice = lstDevice.begin(); itDevice != lstDevice.end(); ++itDevice) { - const QString &serialNumberLst = (*itDevice)->hwAddress(); - const QString &logicalNameLst = (*itDevice)->logicalName(); - if (serialNumberLshw == serialNumberLst || logicalNameLshw == logicalNameLst) { - // (*itDevice)->setEnableValue(false); - (*itDevice)->setInfoFromHwinfo(*it); - } - } - } + const QList> &lstHWInfo = DeviceManager::instance()->cmdInfo("hwinfo_network"); + for (QList >::const_iterator it = lstHWInfo.begin(); it != lstHWInfo.end(); ++it) { + + // 先判断是否是有效网卡信息 + // 符合两种情况中的一种 1. "HW Address" 和 "Permanent HW Address" 都必须有 2. 有 "unique_id" + if (((*it).find("HW Address") == (*it).end() && (*it).find("Permanent HW Address") == (*it).end()) && ((*it).find("unique_id") == (*it).end())) { + continue; + } + + const QString &serialNumberHwinfo = (*it)["HW Address"]; + const QString &logicalNameHwinfo = (*it)["Device File"]; + for (QList::iterator itDevice = lstDevice.begin(); itDevice != lstDevice.end(); ++itDevice) { + const QString &serialNumberLst = (*itDevice)->hwAddress(); + const QString &logicalNameLst = (*itDevice)->logicalName(); + // 如果(*it)中包含unique_id属性,则说明是从数据库里面获取的,否则是从hwinfo中获取的 + if ((*it).find("unique_id") != (*it).end()) { + const QString &unique_id = (*it)["unique_id"]; + if (!unique_id.isEmpty() && (*itDevice)->uniqueID() == unique_id) { + (*itDevice)->setEnableValue(false); + } + + } else if (serialNumberHwinfo == serialNumberLst || logicalNameHwinfo == logicalNameLst) { + (*itDevice)->setInfoFromHwinfo(*it); + } else { + (*itDevice)->setCanUninstall(false); + (*itDevice)->setForcedDisplay(true); + } + } + } + foreach (DeviceNetwork *device, lstDevice) { DeviceManager::instance()->addNetworkDevice(device); } } - void DeviceGenerator::generatorAudioDevice() { // 生成音频适配器 @@ -604,6 +592,9 @@ void DeviceGenerator::getDiskInfoFromSmartCtl() const QList> &lstMap = DeviceManager::instance()->cmdInfo("smart"); QList >::const_iterator it = lstMap.begin(); for (; it != lstMap.end(); ++it) { + // 剔除未识别的磁盘 + if (!(*it).contains("ln")) + continue; DeviceManager::instance()->setStorageInfoFromSmartctl((*it)["ln"], *it); } } diff --git a/deepin-devicemanager/src/GenerateDevice/HWGenerator.cpp b/deepin-devicemanager/src/GenerateDevice/HWGenerator.cpp index c067a1813..a06420f3a 100644 --- a/deepin-devicemanager/src/GenerateDevice/HWGenerator.cpp +++ b/deepin-devicemanager/src/GenerateDevice/HWGenerator.cpp @@ -14,6 +14,7 @@ #include #include #include +#include // 其它头文件 #include "DeviceManager/DeviceManager.h" @@ -90,16 +91,6 @@ void HWGenerator::generatorCpuDevice() { DeviceGenerator::generatorCpuDevice(); DeviceManager::instance()->setCpuFrequencyIsCur(false); - - if (boardVendorType == "KLVV") { - QList lst = DeviceManager::instance()->convertDeviceList(DT_Cpu); - for (int i = 0; i < lst.size(); i++) { - QMap tempMap; - tempMap["Name"] = "Kirin 9006C"; - DeviceBaseInfo *device = lst[i]; - DeviceManager::instance()->tomlDeviceMapSet(DT_Cpu, device,tempMap); - } - } } void HWGenerator::generatorAudioDevice() @@ -107,19 +98,70 @@ void HWGenerator::generatorAudioDevice() getAudioInfoFromCatAudio(); } +QList > readFileSysWifi() +{ + QList > lstWifiInfo; + QString wifiDevicesInfoPath("/sys/hisys/wal/wifi_devices_info"); + QFile file(wifiDevicesInfoPath); + if (file.open(QIODevice::ReadOnly)) { + QMap wifiInfo; + QString allStr = file.readAll(); + file.close(); + + // 解析数据 + QStringList items = allStr.split("\n"); + foreach (const QString &item, items) { + if (item.isEmpty()) + continue; + + QStringList strList = item.split(':', QString::SkipEmptyParts); + if (strList.size() == 2) + wifiInfo[strList[0] ] = strList[1]; + } + + if (!wifiInfo.isEmpty()) + lstWifiInfo.append(wifiInfo); + } + return lstWifiInfo; +} void HWGenerator::generatorBluetoothDevice() { getBluetoothInfoFromHciconfig(); getBlueToothInfoFromHwinfo(); getBluetoothInfoFromLshw(); - getBluetoothInfoFromCatWifiInfo(); + + QList > lstWifiInfo = readFileSysWifi(); + if (lstWifiInfo.size() == 0) { + return; + } + QList >::const_iterator it = lstWifiInfo.begin(); + QMap tempMap; + for (; it != lstWifiInfo.end(); ++it) { + if ((*it).size() < 3) { + continue; + } + + // KLU的问题特殊处理 + foreach (const QString &key, (*it).keys()) { + tempMap.insert(key, (*it)[key]); + } + + // cat /sys/hisys/wal/wifi_devices_info 获取结果为 HI103 + if (tempMap["Chip Type"].contains(Common::specialHString(), Qt::CaseInsensitive)) { + tempMap["Chip Type"] = tempMap["Chip Type"].remove(Common::specialHString()).trimmed(); + } + + // 按照华为的需求,设置蓝牙制造商和类型 + tempMap["Vendor"] = Common::specialHString(); + tempMap["Type"] = "Bluetooth Device"; + tempMap["Name"] = tempMap["Chip Type"]; + } + QList lst = DeviceManager::instance()->convertDeviceList(DT_Bluetoorh); for (int i = 0; i < lst.size(); i++) { DeviceBaseInfo *device = lst[i]; - QString vendor = DeviceManager::instance()->tomlDeviceReadKeyValue(DT_Bluetoorh, device, "Vendor"); - if (vendor.contains("HISILICON",Qt::CaseInsensitive)) { - QMap tempMap; - tempMap["Vendor"] = Common::specialHString(); + QString bus = DeviceManager::instance()->tomlDeviceReadKeyValue(DT_Bluetoorh, device, "Bus"); //内置:UART 外接USB:USB + if (bus.contains("UART",Qt::CaseInsensitive)) { DeviceManager::instance()->tomlDeviceMapSet(DT_Bluetoorh, device,tempMap); } } @@ -171,16 +213,49 @@ void HWGenerator::generatorNetworkDevice() { DeviceGenerator::generatorNetworkDevice(); - if (boardVendorType == "KLVV") { - getNetworkInfoFromCatWifiInfo(); + QList > lstWifiInfo = readFileSysWifi(); + if (lstWifiInfo.size() == 0) { + return; } + QList >::const_iterator it = lstWifiInfo.begin(); + for (; it != lstWifiInfo.end(); ++it) { + if ((*it).size() < 3) { + continue; + } + + // cat /sys/hisys/wal/wifi_devices_info的问题特殊处理 获取结果为 HI103 + QMap tempMap; + foreach (const QString &key, (*it).keys()) { + tempMap.insert(key, (*it)[key]); + } + + tempMap["Name"] = tempMap["Chip Type"]; + if (tempMap["Chip Type"].contains(Common::specialHString(), Qt::CaseInsensitive)) { + tempMap["Name"] = tempMap["Chip Type"].remove(Common::specialHString()).trimmed(); + } + + if (tempMap["NIC Type"].contains("WLAN", Qt::CaseInsensitive)) { + } + + // 按照华为的需求,设置蓝牙制造商和类型 + tempMap["Vendor"] = "HISILICON"; + tempMap["Type"] = "Wireless network"; + + QList lst = DeviceManager::instance()->convertDeviceList(DT_Network); + for (int i = 0; i < lst.size(); i++) { + DeviceBaseInfo *device = lst[i]; + QString logicalName = DeviceManager::instance()->tomlDeviceReadKeyValue(DT_Network, device, "Logical Name"); + if (logicalName.contains("wlan", Qt::CaseInsensitive)) { + DeviceManager::instance()->tomlDeviceMapSet(DT_Network, device,tempMap); + } + } + } } void HWGenerator::generatorDiskDevice() { DeviceGenerator::generatorDiskDevice(); - DeviceManager::instance()->checkDiskSize(); QString bootdevicePath("/proc/bootdevice/product_name"); QString modelStr = ""; @@ -189,7 +264,7 @@ void HWGenerator::generatorDiskDevice() modelStr = file.readLine().simplified(); file.close(); } - if(modelStr.isEmpty()) + if (modelStr.isEmpty()) return; QList lst = DeviceManager::instance()->convertDeviceList(DT_Storage); @@ -205,28 +280,26 @@ void HWGenerator::generatorDiskDevice() tempMap["Name"] = "nouse"; // 应HW的要求,将描述固定为 Universal Flash Storage tempMap["Description"] = "Universal Flash Storage"; - // 应HW的要求,添加interface UFS 3.1 - - if (boardVendorType == "KLVV") - tempMap["Interface"] = "UFS 3.1"; - else if (boardVendorType == "KLVU") { - // 读取interface版本 - QProcess process; - process.start("cat /sys/devices/platform/f8200000.ufs/host0/scsi_host/host0/wb_en"); - process.waitForFinished(-1); - int exitCode = process.exitCode(); - if (exitCode != 127 && exitCode != 126) { - QString deviceInfo = process.readAllStandardOutput(); - if (deviceInfo.trimmed() == "true") { - process.start("cat /sys/block/sdd/device/spec_version"); - process.waitForFinished(-1); - exitCode = process.exitCode(); - if (exitCode != 127 && exitCode != 126) { - deviceInfo = process.readAllStandardOutput(); - if (deviceInfo.trimmed() == "310") { - tempMap["interface"] = "UFS 3.1"; - } - } + // 应H的要求,添加interface UFS 3.1 + tempMap["Interface"] = "UFS 3.1"; + + // 读取interface版本 + QProcess process; + process.start("cat /sys/devices/platform/f8200000.ufs/host0/scsi_host/host0/wb_en"); + process.waitForFinished(-1); + int exitCode = process.exitCode(); + if (exitCode != 127 && exitCode != 126) { + QString deviceInfo = process.readAllStandardOutput(); + if (deviceInfo.trimmed() == "true") { + process.start("cat /sys/block/sdd/device/spec_version"); + process.waitForFinished(-1); + exitCode = process.exitCode(); + if (exitCode != 127 && exitCode != 126) { + deviceInfo = process.readAllStandardOutput(); + if (deviceInfo.trimmed() == "310") { + tempMap["interface"] = "UFS 3.1"; + } else if (deviceInfo.trimmed() == "300") + tempMap["interface"] = "UFS 3.0"; } } } @@ -234,6 +307,8 @@ void HWGenerator::generatorDiskDevice() DeviceManager::instance()->tomlDeviceMapSet(DT_Storage, device,tempMap); } } + + DeviceManager::instance()->checkDiskSize(); //place in the end } void HWGenerator::getAudioInfoFromCatAudio() @@ -263,29 +338,6 @@ void HWGenerator::getAudioInfoFromCatAudio() } } -void HWGenerator::getDiskInfoFromSmartCtl() -{ - const QList> lstMap = DeviceManager::instance()->cmdInfo("smart"); - QList >::const_iterator it = lstMap.begin(); - for (; it != lstMap.end(); ++it) { - // 剔除未识别的磁盘 - if (!(*it).contains("ln")) - continue; - - // KLU的问题特殊处理 - QMap tempMap; - foreach (const QString &key, (*it).keys()) { - tempMap.insert(key, (*it)[key]); - } - - // 按照HW的需求,如果是固态硬盘就不显示转速 - if (tempMap["Rotation Rate"] == "Solid State Device") - tempMap["Rotation Rate"] = "HW_SSD"; - - DeviceManager::instance()->setStorageInfoFromSmartctl(tempMap["ln"], tempMap); - } -} - void HWGenerator::getBluetoothInfoFromHciconfig() { const QList> lstMap = DeviceManager::instance()->cmdInfo("hciconfig"); @@ -332,60 +384,6 @@ void HWGenerator::getBluetoothInfoFromLshw() } } -void HWGenerator::getBluetoothInfoFromCatWifiInfo() -{ - QList > lstWifiInfo; - QString wifiDevicesInfoPath("/sys/hisys/wal/wifi_devices_info"); - QFile file(wifiDevicesInfoPath); - if (file.open(QIODevice::ReadOnly)) { - QMap wifiInfo; - QString allStr = file.readAll(); - file.close(); - - // 解析数据 - QStringList items = allStr.split("\n"); - foreach (const QString &item, items) { - if (item.isEmpty()) - continue; - - QStringList strList = item.split(':', QString::SkipEmptyParts); - if (strList.size() == 2) - wifiInfo[strList[0] ] = strList[1]; - } - - if (!wifiInfo.isEmpty()) - lstWifiInfo.append(wifiInfo); - } - - if (lstWifiInfo.size() == 0) { - return; - } - QList >::const_iterator it = lstWifiInfo.begin(); - - for (; it != lstWifiInfo.end(); ++it) { - if ((*it).size() < 3) { - continue; - } - - // KLU的问题特殊处理 - QMap tempMap; - foreach (const QString &key, (*it).keys()) { - tempMap.insert(key, (*it)[key]); - } - - // cat /sys/hisys/wal/wifi_devices_info 获取结果为 HI103 - if (tempMap["Chip Type"].contains(Common::specialHString(), Qt::CaseInsensitive)) { - tempMap["Chip Type"] = tempMap["Chip Type"].remove(Common::specialHString()).trimmed(); - } - - // 按照华为的需求,设置蓝牙制造商和类型 - tempMap["Vendor"] = "HISILICON"; - tempMap["Type"] = "Bluetooth Device"; - - DeviceManager::instance()->setBluetoothInfoFromWifiInfo(tempMap); - } -} - void HWGenerator::getMemoryInfoFromLshw() { // 从lshw中获取内存信息 @@ -422,14 +420,14 @@ static void parseEDID(QStringList allEDIDS,QString input) process.waitForFinished(-1); QString deviceInfo = process.readAllStandardOutput(); - if(deviceInfo.isEmpty()) + if (deviceInfo.isEmpty()) continue; QString edidStr; QStringList lines = deviceInfo.split("\n"); for (auto line:lines) { QStringList words = line.trimmed().split(" "); - if(words.size() != 9) + if (words.size() != 9) continue; words.removeAt(0); @@ -439,7 +437,7 @@ static void parseEDID(QStringList allEDIDS,QString input) } lines = edidStr.split("\n"); - if(lines.size() > 3){ + if (lines.size() > 3){ EDIDParser edidParser; QString errorMsg; edidParser.setEdid(edidStr,errorMsg,"\n", false); @@ -460,20 +458,18 @@ static void parseEDID(QStringList allEDIDS,QString input) void HWGenerator::generatorMonitorDevice() { - if (boardVendorType == "KLVV" || boardVendorType == "KLVU") { - QMap mapInfo; - mapInfo.insert("Name", "LCD"); - mapInfo.insert("Current Resolution", "2160x1440"); - mapInfo.insert("Support Resolution", "2160x1440"); - mapInfo.insert("Size", "14 Inch"); - mapInfo.insert("Interface Type", "eDP"); - mapInfo.insert("Refresh Rate", "60Hz"); - - DeviceMonitor *monitor = new DeviceMonitor(); - monitor->setInfoFromTomlBase(mapInfo); - monitor->setInfoFromTomlOneByOne(mapInfo); - DeviceManager::instance()->addMonitor(monitor); - } + QMap mapInfo; + mapInfo.insert("Name", "LCD"); + mapInfo.insert("Current Resolution", "2160x1440"); + mapInfo.insert("Support Resolution", "2160x1440"); + mapInfo.insert("Size", "14 Inch"); + mapInfo.insert("Interface Type", "eDP"); + mapInfo.insert("Refresh Rate", "60Hz"); + + DeviceMonitor *monitor = new DeviceMonitor(); + monitor->setInfoFromTomlBase(mapInfo); + monitor->setInfoFromTomlOneByOne(mapInfo); + DeviceManager::instance()->addMonitor(monitor); QString toDir = "/sys/class/drm"; QDir toDir_(toDir); @@ -483,10 +479,10 @@ void HWGenerator::generatorMonitorDevice() QFileInfoList fileInfoList = toDir_.entryInfoList(); foreach(QFileInfo fileInfo, fileInfoList) { - if(fileInfo.fileName() == "." || fileInfo.fileName() == ".." || !fileInfo.fileName().startsWith("card")) + if (fileInfo.fileName() == "." || fileInfo.fileName() == ".." || !fileInfo.fileName().startsWith("card")) continue; - if(QFile::exists(fileInfo.filePath() + "/" + "edid")) { + if (QFile::exists(fileInfo.filePath() + "/" + "edid")) { QStringList allEDIDS_all; allEDIDS_all.append(fileInfo.filePath() + "/" + "edid"); QString interface = fileInfo.fileName().remove("card0-").remove("card1-").remove("card2-"); @@ -498,136 +494,30 @@ void HWGenerator::generatorMonitorDevice() void HWGenerator::generatorPowerDevice() { DeviceGenerator::generatorPowerDevice(); - - QList lst = DeviceManager::instance()->convertDeviceList(DT_Power); - for (int i = 0; i < lst.size(); i++) { - DeviceBaseInfo *device = lst[i]; - QMap tempMap; - tempMap["energy-full-design"] = "nouse"; - tempMap["energy-full"] = "nouse"; - tempMap["Design Capacity"] = "56 Wh"; - DeviceManager::instance()->tomlDeviceMapSet(DT_Power, device,tempMap); - } } void HWGenerator::generatorKeyboardDevice() { DeviceGenerator::generatorKeyboardDevice(); - - QList lst = DeviceManager::instance()->convertDeviceList(DT_Keyboard); - for (int i = 0; i < lst.size(); i++) { - DeviceBaseInfo *device = lst[i]; - QString vendor = DeviceManager::instance()->tomlDeviceReadKeyValue(DT_Keyboard, device, "Vendor"); - if (vendor.contains("14f3",Qt::CaseInsensitive)) { - QMap tempMap; - tempMap["Vendor"] = Common::specialHString(); - DeviceManager::instance()->tomlDeviceMapSet(DT_Keyboard, device,tempMap); - } - } } void HWGenerator::generatorMemoryDevice() { DeviceGenerator::generatorMemoryDevice(); - - QList lst = DeviceManager::instance()->convertDeviceList(DT_Memory); - for (int i = 0; i < lst.size(); i++) { - DeviceBaseInfo *device = lst[i]; - QString vendor = DeviceManager::instance()->tomlDeviceReadKeyValue(DT_Memory, device, "Vendor"); - QString partNumber = DeviceManager::instance()->tomlDeviceReadKeyValue(DT_Memory, device, "Name"); - if (vendor.contains("Samsung",Qt::CaseInsensitive)) { - QMap tempMap; - tempMap["Vendor"] = "nouse"; - tempMap["Part Number"] = "nouse"; - DeviceManager::instance()->tomlDeviceMapSet(DT_Memory, device,tempMap); - } - if (partNumber.contains("K3LK7K70BM",Qt::CaseInsensitive)) { - QMap tempMap; - tempMap["Name"] = "nouse"; - tempMap["Part Number"] = "nouse"; - DeviceManager::instance()->tomlDeviceMapSet(DT_Memory, device,tempMap); - } - } } void HWGenerator::generatorCameraDevice() { DeviceGenerator::generatorCameraDevice(); - if (boardVendorType == "KLVV") { - QList lst = DeviceManager::instance()->convertDeviceList(DT_Image); - for (int i = 0; i < lst.size(); i++) { - DeviceBaseInfo *device = lst[i]; - QString vendor = DeviceManager::instance()->tomlDeviceReadKeyValue(DT_Image, device, "Vendor"); - if (vendor.contains("0000058020",Qt::CaseInsensitive)) { - QMap tempMap; - tempMap["Vendor"] = "nouse"; - DeviceManager::instance()->tomlDeviceMapSet(DT_Image, device,tempMap); - } - } - } -} - -void HWGenerator::getNetworkInfoFromCatWifiInfo() -{ - QList > lstWifiInfo; - QString wifiDevicesInfoPath("/sys/hisys/wal/wifi_devices_info"); - QFile file(wifiDevicesInfoPath); - if (file.open(QIODevice::ReadOnly)) { - QMap wifiInfo; - QString allStr = file.readAll(); - file.close(); - - // 解析数据 - QStringList items = allStr.split("\n"); - foreach (const QString &item, items) { - if (item.isEmpty()) - continue; - - QStringList strList = item.split(':', QString::SkipEmptyParts); - if (strList.size() == 2) - wifiInfo[strList[0] ] = strList[1]; - } - - if (!wifiInfo.isEmpty()) - lstWifiInfo.append(wifiInfo); - } - if (lstWifiInfo.size() == 0) { - return; - } - - QList >::const_iterator it = lstWifiInfo.begin(); - for (; it != lstWifiInfo.end(); ++it) { - if ((*it).size() < 3) { - continue; - } - - // KLU的问题特殊处理 - QMap tempMap; - foreach (const QString &key, (*it).keys()) { - tempMap.insert(key, (*it)[key]); - } - - // cat /sys/hisys/wal/wifi_devices_info 获取结果为 HI103 - tempMap["Name"] = tempMap["Chip Type"]; - if (tempMap["Chip Type"].contains(Common::specialHString(), Qt::CaseInsensitive)) { - tempMap["Name"] = tempMap["Chip Type"].remove(Common::specialHString()).trimmed(); - } - - if (tempMap["NIC Type"].contains("WLAN", Qt::CaseInsensitive)) { - } - - // 按照华为的需求,设置蓝牙制造商和类型 - tempMap["Vendor"] = "HISILICON"; - tempMap["Type"] = "Wireless network"; - - QList lst = DeviceManager::instance()->convertDeviceList(DT_Network); - for (int i = 0; i < lst.size(); i++) { - DeviceBaseInfo *device = lst[i]; - QString logicalName = DeviceManager::instance()->tomlDeviceReadKeyValue(DT_Network, device, "Logical Name"); - if (logicalName.contains("wlan", Qt::CaseInsensitive)) { - DeviceManager::instance()->tomlDeviceMapSet(DT_Network, device,tempMap); - } + QList lst = DeviceManager::instance()->convertDeviceList(DT_Image); + for (int i = 0; i < lst.size(); i++) { + DeviceBaseInfo *device = lst[i]; + QString vendor = DeviceManager::instance()->tomlDeviceReadKeyValue(DT_Image, device, "Vendor"); + if (vendor.contains("0000058020",Qt::CaseInsensitive)) { + QMap tempMap; + tempMap["Vendor"] = "nouse"; + DeviceManager::instance()->tomlDeviceMapSet(DT_Image, device,tempMap); } } } diff --git a/deepin-devicemanager/src/GenerateDevice/HWGenerator.h b/deepin-devicemanager/src/GenerateDevice/HWGenerator.h index 38a9963e8..45276e13b 100644 --- a/deepin-devicemanager/src/GenerateDevice/HWGenerator.h +++ b/deepin-devicemanager/src/GenerateDevice/HWGenerator.h @@ -85,16 +85,6 @@ class HWGenerator : public DeviceGenerator */ virtual void getAudioInfoFromCatAudio() ; - // /** - // * @brief getDiskInfoFromLshw:从lshw获取存储设备信息 - // */ - // virtual void getDiskInfoFromLshw() override; - - /** - * @brief getDiskInfoFromSmartCtl:从smartctl获取存储设备信息 - */ - virtual void getDiskInfoFromSmartCtl() override; - /** * @brief getBluetoothInfoFromHciconfig:hciconfig获取蓝牙信息 */ @@ -110,16 +100,11 @@ class HWGenerator : public DeviceGenerator */ virtual void getBluetoothInfoFromLshw() override; - /**@brief:generator bluetooth info*/ - virtual void getBluetoothInfoFromCatWifiInfo(); - /** * @brief getMemoryInfoFromLshw:从lshw获取内存信息 */ virtual void getMemoryInfoFromLshw() override; - /**@brief:generator network info*/ - virtual void getNetworkInfoFromCatWifiInfo(); }; diff --git a/deepin-devicemanager/src/Page/MainWindow.cpp b/deepin-devicemanager/src/Page/MainWindow.cpp index b1ed0d939..ad4043a43 100644 --- a/deepin-devicemanager/src/Page/MainWindow.cpp +++ b/deepin-devicemanager/src/Page/MainWindow.cpp @@ -427,6 +427,12 @@ void MainWindow::initWindowTitle() Common::specialComType = dconfig->value("specialComType").toInt(); } qCInfo(appLog) << "Common::specialComType value is:" << Common::specialComType; + + if (dconfig && dconfig->isValid() && dconfig->keyList().contains("TomlFilesName")) { + QString tomlFilesName = dconfig->value("TomlFilesName").toString(); + Common::tomlFilesNameSet(tomlFilesName); + } + #endif // 特殊处理 if (!Common::boardVendorType().isEmpty()) diff --git a/deepin-devicemanager/src/commonfunction.cpp b/deepin-devicemanager/src/commonfunction.cpp index 1326e133b..40c94cbe6 100644 --- a/deepin-devicemanager/src/commonfunction.cpp +++ b/deepin-devicemanager/src/commonfunction.cpp @@ -32,7 +32,7 @@ static QMap mapArch = { {"aarch64", "arm64"} static bool initBoardVendorFlag = false; static QString boardVendorKey = ""; int Common::specialComType = -1; - +static QString tomlFilesName = "tomlFilesName"; QString Common::getArch() { QString arch; @@ -197,6 +197,16 @@ QString Common::specialHString() return result; } +void Common::tomlFilesNameSet(QString name) +{ + tomlFilesName = name; +} + +QString Common::tomlFilesNameGet() +{ + return tomlFilesName; +} + QByteArray Common::executeClientCmd(const QString &cmd, const QStringList &args, const QString &workPath, int msecsWaiting/* = 30000*/) { QProcess process; diff --git a/deepin-devicemanager/src/commonfunction.h b/deepin-devicemanager/src/commonfunction.h index 68808b5a7..32a5124dc 100644 --- a/deepin-devicemanager/src/commonfunction.h +++ b/deepin-devicemanager/src/commonfunction.h @@ -33,6 +33,9 @@ class Common static QString boardVendorType(); static QString specialVendorType(); static QString specialHString(); + static QString tomlFilesNameGet(); + static void tomlFilesNameSet(QString name); + /** * @brief specialComType * special computer type:PGUW(value:1),KLVV/L540(value:2),KLVU(value:3),PGUV/W585(value:4) diff --git a/deepin-devicemanager/src/main.cpp b/deepin-devicemanager/src/main.cpp index b385d2f6f..c12e182c0 100644 --- a/deepin-devicemanager/src/main.cpp +++ b/deepin-devicemanager/src/main.cpp @@ -89,12 +89,13 @@ int main(int argc, char *argv[]) if (!DGuiApplicationHelper::instance()->setSingleInstance(app.applicationName(), DGuiApplicationHelper::UserScope)) { exit(0); } +#ifndef DISABLE_POLKIT Authority::Result result = Authority::instance()->checkAuthorizationSync("com.deepin.deepin-devicemanager.checkAuthentication", UnixProcessSubject(getpid()), Authority::AllowUserInteraction); if (result != Authority::Yes) return 0; - +#endif DApplicationSettings settinAgs; Dtk::Core::DLogManager::registerFileAppender(); diff --git a/deepin-devicemanager/translations/deepin-devicemanager_zh_CN.ts b/deepin-devicemanager/translations/deepin-devicemanager_zh_CN.ts index 92b65179c..0896238af 100644 --- a/deepin-devicemanager/translations/deepin-devicemanager_zh_CN.ts +++ b/deepin-devicemanager/translations/deepin-devicemanager_zh_CN.ts @@ -885,6 +885,91 @@ 卸载驱动 + + TableWidget + + + + Disable + 禁用 + + + + Refresh + 刷新 + + + + Export + 导出 + + + + Update drivers + 更新驱动 + + + + Uninstall drivers + 卸载驱动 + + + + Allow it to wake the computer + 允许唤起电脑 + + + + + Enable + 启用 + + + + + TextBrowser + + + Refresh + 刷新 + + + + Export + 导出 + + + + Copy + 复制 + + + + Disable + 禁用 + + + + Unavailable + 不可用 + + + + UrlChooserEdit + + + Select a local folder please + 请选择本地文件夹 + + + + WaitingWidget + + + Loading... + 正在载入... + + QObject @@ -919,14 +1004,6 @@ No motherboard found 未发现主板 - - - - - - Memory - 内存 - @@ -1584,1821 +1661,1686 @@ Install 安装 + + + DeviceBaseInfo - + One - + Two - + Four - + Six - + Eight - + Nine - + Ten - + Twelve 十二 - + Fourteen 十四 - + Sixteen 十六 - + Eighteen 十八 - + Twenty 二十 - + Twenty-two 二十二 - + Twenty-four 二十四 - + Twenty-six 二十六 - + Twenty-eight 二十八 - + Thirty 三十 - + Thirty-two 三十二 - + Thirty-four 三十四 - + Thirty-six 三十六 - + Thirty-eight 三十八 - + Forty 四十 - + Forty-two 四十二 - + Forty-four 四十四 - + Forty-six 四十六 - + Forty-eight 四十八 - + Fifty 五十 - + Fifty-two 五十二 - + Fifty-four 五十四 - + Fifty-six 五十六 - + Fifty-eight 五十八 - + Sixty 六十 - + Sixty-two 六十二 - + Sixty-four 六十四 - + Sixty-six 六十六 - + Sixty-eight 六十八 - + Seventy 七十 - + Seventy-two 七十二 - + Seventy-four 七十四 - + Seventy-six 七十六 - + Seventy-eight 七十八 - + Eighty 八十 - + Eighty-two 八十二 - + Eighty-four 八十四 - + Eighty-six 八十六 - + Eighty-eight 八十八 - + Ninety 九十 - + Ninety-two 九十二 - + Ninety-four 九十四 - + Ninety-six 九十六 - + Ninety-eight 九十八 - + One hundred 一百 - + One hundred and Two 一百零二 - + One hundred and four 一百零四 - + One hundred and Six 一百零六 - + One hundred and Eight 一百零八 - + One hundred and Ten 一百一十 - + One hundred and Twelve 一百一十二 - + One hundred and Fourteen 一百一十四 - + One hundred and Sixteen 一百一十六 - + One hundred and Eighteen 一百一十八 - + One hundred and Twenty 一百二十 - + One hundred and Twenty-two 一百二十二 - + One hundred and Twenty-four 一百二十四 - + One hundred and Twenty-six 一百二十六 - + One hundred and Twenty-eight 一百二十八 - + One hundred and Ninety-two 一百九十二 - + Two hundred and fifty-six 二百五十六 - - Core(s) - - - - - BIOS Information - BIOS信息 - - - - Base Board Information - 主板信息 - - - - System Information - 系统信息 - - - - Chassis Information - 机箱信息 - - - - Physical Memory Array - 内存插槽信息 - - - - Processor - 逻辑处理器 - - - - - inch - 英寸 - - - - - - - - - SSD - 固态 - - - - TableWidget - - - - Disable - 禁用 - - - - Refresh - 刷新 - - - - Export - 导出 - - - - Update drivers - 更新驱动 - - - - Uninstall drivers - 卸载驱动 - - - - Allow it to wake the computer - 允许唤起电脑 - - - - - Enable - 启用 - - - - - TextBrowser - - - Refresh - 刷新 - - - - Export - 导出 - - - - Copy - 复制 - - - - Disable - 禁用 - - - - Unavailable - 不可用 - - - - UrlChooserEdit - - - Select a local folder please - 请选择本地文件夹 - - - - WaitingWidget - - - Loading... - 正在载入... - - - - DeviceBaseInfo - - + Device Name 设备名称 - - + + Vendor 制造商 - + Chip 芯片 - - + + Physical ID 物理ID - + SysFS_Path - + Revision - + KernelModeDriver - + IRQ 中断 - + Disable 禁用 - + Version 版本 - + Chipset 芯片组 - + Module Alias 模块别名 - + Speed 速度 - + Maximum Power 最大功率 - + Driver 驱动 - + Driver Version 驱动版本 - + Capabilities 功能 - + logical name 逻辑名称 - + Logical Name 逻辑名称 - + MAC Address 物理地址 - + CPU ID 处理器ID - + Core ID 核心ID - + Threads 线程数 - + BogoMIPS 运行速度(Bogomips) - + Architecture 架构 - + CPU Family 家族 - - + + Processor 逻辑处理器 - + Core(s) - + Virtualization 虚拟化 - + Flags 特性 - + Extensions 扩展指令集 - + L3 Cache L3缓存 - + L4 Cache L4缓存 - + L2 Cache L2缓存 - + L1i Cache L1缓存(指令) - + L1d Cache L1缓存(数据) - + Stepping 步进 - + Frequency 频率 - - - + + + Max Frequency 最大频率 - + Graphics Memory 显存 - + Memory Address 内存地址 - + IO Port I/O端口 - + Maximum Resolution 最大分辨率 - + Minimum Resolution 最小分辨率 - + Description 描述 - + DP DP - + eDP eDP - + HDMI HDMI - + VGA VGA - + DVI DVI - + DigitalOutput DigitalOutput - + Display Output 显示输出 - + Interface 接口 - + Bus Info 总线信息 - + bus info 总线信息 - + Maximum Current 最大电流 - + Unavailable 不可用 - + Type 类型 - + Total Width 总位宽 - + Locator 插槽 - + Configured Voltage 配置电压 - + Maximum Voltage 最高电压 - + Minimum Voltage 最低电压 - + Configured Speed 配置速度 - + Data Width 数据位宽 - + Display Input 显示输入 - + Interface Type 接口类型 - + Support Resolution 支持分辨率 - + Current Resolution 当前分辨率 - + Refresh Rate 刷新率 - + Display Ratio 显示比例 - + Primary Monitor 主显示器 - + Size 大小 - + Maximum Rate 最大速率 - + Negotiation Rate 协商速率 - + Port 端口 - + Multicast 组播 - + Link 连接 - + Latency 延迟 - + IP IP - + Firmware 固件 - + Duplex 双工 - + Broadcast 广播 - + Auto Negotiation 自动协商 - + Input/Output 输入/输出 - + Memory 内存 - + Model 型号 - + Status 状态 - + Capacity 最大容量 - + Voltage 电压 - + Slot 插槽 - + Design Capacity 设计容量 - + Design Voltage 设计电压 - + SBDS Version SBDS版本 - + SBDS Serial Number SBDS序列号 - + SBDS Manufacture Date SBDS制造日期 - + SBDS Chemistry SBDS材料 - + Temperature 温度 - + Name 名称 - + Shared 已共享 - + URI URI - + Media Type 介质类型 - + Firmware Version 固件版本 - + Serial Number 序列号 - + Rotation Rate 转速 - + SubVendor 子制造商 - + SubDevice 子设备 - + Driver Status 驱动状态 - + Config Status 配置状态 - + Phys Phys - + Sysfs Sysfs - + Handlers 处理程序 - + PROP PROP - + EV EV - + KEY KEY - + Bus 总线 - + BIOS Information BIOS信息 - + Base Board Information 主板信息 - + System Information 系统信息 - + Chassis Information 机箱信息 - + Physical Memory Array 内存插槽信息 - + Release Date 发布日期 - + Address 地址 - + Runtime Size 运行内存大小 - + ROM Size ROM大小 - + Characteristics 特性 - + BIOS Revision BIOS修订版本 - + Firmware Revision 固件修订版本 - + Product Name 产品名称 - + Asset Tag 资产编号 - + Features 特征 - + Location In Chassis 机箱内位置 - + Chassis Handle 机箱程序 - + Contained Object Handles 包含对象程序 - + UUID UUID - + Wake-up Type 唤醒类型 - + SKU Number SKU号 - + Family 家族 - + Lock - + Boot-up State 开机状态 - + Power Supply State 供电状态 - + Thermal State 散热状态 - + Security Status 安全状态 - + OEM Information OEM信息 - + Height 高度 - + Number Of Power Cords 电源线数 - + Contained Elements 包含组件数 - + Location 位置 - + Error Correction Type 纠错类型 - + Maximum Capacity 最大容量 - + Error Information Handle 错误信息程序 - + Number Of Devices 卡槽数量 - + BIOS ROMSIZE BIOS ROM大小 - + Release date 发布日期 - + Board name 主板名称 - + SMBIOS Version SMBIOS版本 - + Language Description Format 语言描述格式 - + Installable Languages 可安装语言数 - + Currently Installed Language 当前安装语言 - + BD Address 蓝牙设备地址 - + ACL MTU ACL MTU - + SCO MTU SCO MTU - + Packet type 数据包类型 - + Link policy 连接策略 - + Link mode 连接模式 - + Class 类别 - + Service Classes 服务类别 - + Device Class 设备类别 - + HCI Version HCI版本 - + LMP Version LMP版本 - + Subversion 子版本 - + Device 设备 - + Serial ID 序列号 - + product 产品 - + Powered 供电 - + Discoverable 可发现 - + Pairable 可配对 - + Modalias 设置命令别名 - + Discovering 搜索中 - + Device File 设备文件 - + Device Files 设备文件 - + Device Number 设备编号 - + Application 应用 - + ansiversion ANSI版本 - + CPU implementer CPU程序 - + CPU architecture CPU架构 - + CPU variant CPU变量 - + CPU part CPU部件 - + CPU revision CPU版本 - + GDDR capacity GDDR容量 - + GPU vendor GPU供应商 - + GPU type GPU类型 - + EGL version EGL版本 - + EGL client APIs EGL接口 - + GL version GL版本 - + GLSL version GLSL版本 - - - + + + Unknown 未知 - + Uniq Uniq - + MSC MSC - - - + + + Hardware Class 硬件类别 - + Array Handle 数组程序 - + Form Factor 尺寸型号 - + Set 设置 - + Bank Locator 内存通道 - + Part Number 部件号码 - + Rank 位列 - + Memory Technology 内存技术 - + Memory Operating Mode Capability 内存操作模式 - + Module Manufacturer ID 组件制造商 - + Module Product ID 组件产品ID - + Memory Subsystem Controller Manufacturer ID 内存子系统控制器制造商 - + Memory Subsystem Controller Product ID 内存子系统控制器产品ID - + Non-Volatile Size 不易丢失大小 - + Volatile Size 易丢失大小 - + Cache Size 缓存大小 - + Logical Size 逻辑大小 - + + inch 英寸 - + Date 日期 - + ioport I/O端口 - + network 网络 - + battery 电池 - + native-path 安装路径 - + power supply 供电 - + updated 更新时间 - + has history 历史记录 - + has statistics 用电统计 - + rechargeable 可再充电 - + state 状态 - + warning-level 警告等级 - + energy 容量 - + energy-empty 最低容量 - + energy-full 完全充满容量 - + energy-full-design 设计容量 - + energy-rate 能量密度 - + percentage 电量 - + technology 电池技术 - + icon-name 图标 - + online 在线 - + daemon-version Daemon版本 - + on-battery 使用电池 - + lid-is-closed 笔记本合盖 - + lid-is-present 打开笔记本盖子 - + critical-action 电量极低时执行 - + copies 复印数量 - + job-cancel-after 此时取消打印任务 - + job-hold-until 保留打印任务直至 - + job-priority 任务优先级 - + marker-change-time 标记修改次数 - + number-up 编号 - + orientation-requested 打印方向 - + print-color-mode 颜色模式 - + printer-is-accepting-jobs 当前可打印 - + printer-is-shared 打印机已共享 - + printer-is-temporary 临时打印机 - + printer-make-and-model 制造商和型号 - + printer-state-change-time 打印机状态修改时间 - + printer-state-reasons 打印机状态信息 - + printer-type 打印机类型 - + printer-uri-supported 支持的URI - + sides 打印面数 - + SSD 固态 - + HDD 机械 - + logicalsectorsize 逻辑分区大小 - + sectorsize 扇区大小 - + guid 全局唯一标识符 - + Geometry (Logical) 几何数据(逻辑) From 1c816832db64f7079198cee298a5beedab430eee Mon Sep 17 00:00:00 2001 From: shuaijie Date: Sat, 30 Nov 2024 17:02:10 +0800 Subject: [PATCH 03/69] fix: [network] add network full support add network full support Log: add network full support Bug: https://pms.uniontech.com/bug-view-286267.html --- .../src/GenerateDevice/DeviceGenerator.cpp | 113 ++++++++++++------ 1 file changed, 78 insertions(+), 35 deletions(-) diff --git a/deepin-devicemanager/src/GenerateDevice/DeviceGenerator.cpp b/deepin-devicemanager/src/GenerateDevice/DeviceGenerator.cpp index 2eed3e0c7..5dfe2d885 100644 --- a/deepin-devicemanager/src/GenerateDevice/DeviceGenerator.cpp +++ b/deepin-devicemanager/src/GenerateDevice/DeviceGenerator.cpp @@ -25,6 +25,7 @@ #include "DeviceManager/DevicePrint.h" #include "DeviceManager/DeviceInput.h" #include "MacroDefinition.h" +#include "DDLog.h" // Dtk头文件 #include @@ -34,6 +35,8 @@ #include #include +using namespace DDLog; + DeviceGenerator::DeviceGenerator(QObject *parent) : QObject(parent) { @@ -244,6 +247,32 @@ void DeviceGenerator::generatorMonitorDevice() getMonitorInfoFromHwinfo(); } +bool isValidLogicalName(const QString& logicalName) +{ + if (logicalName.contains("p2p", Qt::CaseInsensitive)) + return false; + + QString addressFilePath = "/sys/class/net/" + logicalName; + QDir dir(addressFilePath); + if (dir.exists()) + return true; + + qCInfo(appLog) << dir << "not exist in /sys/class/net/"; + return false; +} + +bool isValidMAC(const QString& macAddress) +{ + if (macAddress.contains("00:00:00:00:00:00", Qt::CaseInsensitive) || macAddress.contains("ff:ff:ff:ff:ff:ff", Qt::CaseInsensitive) || macAddress.isEmpty()) + return false; + + QRegularExpression macRegex("([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})"); + if (!macRegex.match(macAddress).hasMatch()) + return false; + + return true; +} + void DeviceGenerator::generatorNetworkDevice() { bool hasWlan =false; @@ -256,62 +285,76 @@ void DeviceGenerator::generatorNetworkDevice() const QString &logicalNameLshw = (*it)["logical name"]; const QString &macAddressLshw = (*it)["serial"]; - if (logicalNameLshw.contains("p2p", Qt::CaseInsensitive)) + if (!isValidLogicalName(logicalNameLshw)) continue; - if (logicalNameLshw.contains("wlan", Qt::CaseInsensitive) && hasWlan) //common sense: one PC only have 1 wlan device + if (!isValidMAC(macAddressLshw)) continue; - if (macAddressLshw.contains("00:00:00:00:00:00", Qt::CaseInsensitive) || macAddressLshw.contains("ff:ff:ff:ff:ff:ff", Qt::CaseInsensitive) || macAddressLshw.isEmpty()) + + if (logicalNameLshw.contains("wlan", Qt::CaseInsensitive) && hasWlan) //common sense: one PC only have 1 wlan device continue; - // Regular expression for validating MAC address - QRegularExpression macRegex("([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})"); - if (!macRegex.match(macAddressLshw).hasMatch()) - continue; - QString addressFilePath = "/sys/class/net/" + logicalNameLshw; - QDir dir(addressFilePath); - if (dir.exists()) { - DeviceNetwork *device = new DeviceNetwork(); - device->setInfoFromLshw(*it); - lstDevice.append(device); - if (logicalNameLshw.contains("wlan", Qt::CaseInsensitive)) - hasWlan = true; - } + DeviceNetwork *device = new DeviceNetwork(); + device->setInfoFromLshw(*it); + lstDevice.append(device); + if (logicalNameLshw.contains("wlan", Qt::CaseInsensitive)) + hasWlan = true; + } - const QList> &lstHWInfo = DeviceManager::instance()->cmdInfo("hwinfo_network"); - for (QList >::const_iterator it = lstHWInfo.begin(); it != lstHWInfo.end(); ++it) { + const QList> &lstHWInfo = DeviceManager::instance()->cmdInfo("hwinfo_network"); + for (QList >::const_iterator it = lstHWInfo.begin(); it != lstHWInfo.end(); ++it) { // 先判断是否是有效网卡信息 // 符合两种情况中的一种 1. "HW Address" 和 "Permanent HW Address" 都必须有 2. 有 "unique_id" - if (((*it).find("HW Address") == (*it).end() && (*it).find("Permanent HW Address") == (*it).end()) && ((*it).find("unique_id") == (*it).end())) { + if (((*it).find("HW Address") == (*it).end() && (*it).find("Permanent HW Address") == (*it).end()) && ((*it).find("unique_id") == (*it).end())) { continue; - } + } - const QString &serialNumberHwinfo = (*it)["HW Address"]; - const QString &logicalNameHwinfo = (*it)["Device File"]; - for (QList::iterator itDevice = lstDevice.begin(); itDevice != lstDevice.end(); ++itDevice) { + const QString &macHwinfo = (*it)["Permanent HW Address"].isEmpty() ? (*it)["HW Address"] : (*it)["Permanent HW Address"]; + const QString &logicalNameHwinfo = (*it)["Device File"]; + bool hasMatchLogicalName = false; + for (QList::iterator itDevice = lstDevice.begin(); itDevice != lstDevice.end(); ++itDevice) { const QString &serialNumberLst = (*itDevice)->hwAddress(); const QString &logicalNameLst = (*itDevice)->logicalName(); // 如果(*it)中包含unique_id属性,则说明是从数据库里面获取的,否则是从hwinfo中获取的 - if ((*it).find("unique_id") != (*it).end()) { - const QString &unique_id = (*it)["unique_id"]; - if (!unique_id.isEmpty() && (*itDevice)->uniqueID() == unique_id) { - (*itDevice)->setEnableValue(false); - } - - } else if (serialNumberHwinfo == serialNumberLst || logicalNameHwinfo == logicalNameLst) { - (*itDevice)->setInfoFromHwinfo(*it); - } else { + if ((*it).find("unique_id") != (*it).end()) { + const QString &unique_id = (*it)["unique_id"]; + if (!unique_id.isEmpty() && (*itDevice)->uniqueID() == unique_id) { + (*itDevice)->setEnableValue(false); + } + + } else if (macHwinfo == serialNumberLst || logicalNameHwinfo == logicalNameLst) { + (*itDevice)->setInfoFromHwinfo(*it); + hasMatchLogicalName = true; + } else { (*itDevice)->setCanUninstall(false); (*itDevice)->setForcedDisplay(true); - } - } - } + } + } + //first check it's valid, if LogicalName not exist but valid please add it . + if (!hasMatchLogicalName && isValidMAC(macHwinfo) && isValidLogicalName(logicalNameHwinfo)) { + if (!logicalNameHwinfo.contains("wlan", Qt::CaseInsensitive)) {//add wired net + DeviceNetwork *device = new DeviceNetwork(); + device->setInfoFromHwinfo(*it); + lstDevice.append(device); + hasMatchLogicalName = true; + } else { //add wireless net + if (!hasWlan) { //common sense: one PC only have 1 wlan device + DeviceNetwork *device = new DeviceNetwork(); + device->setInfoFromHwinfo(*it); + lstDevice.append(device); + hasMatchLogicalName = true; + hasWlan = true; + } + } + } + } foreach (DeviceNetwork *device, lstDevice) { DeviceManager::instance()->addNetworkDevice(device); } } + void DeviceGenerator::generatorAudioDevice() { // 生成音频适配器 From e3c87c6449607e66f07a7ed94d85f49917b8df83 Mon Sep 17 00:00:00 2001 From: shuaijie Date: Tue, 3 Dec 2024 15:14:47 +0800 Subject: [PATCH 04/69] chore: [translate] support lupdate auto support lupdate auto Log: support lupdate auto Bug: https://pms.uniontech.com/task-view-368603.html --- .../src/DeviceManager/DeviceInfo.cpp | 292 +++++++++++++++++- .../src/DeviceManager/DeviceInfo.h | 3 + 2 files changed, 294 insertions(+), 1 deletion(-) diff --git a/deepin-devicemanager/src/DeviceManager/DeviceInfo.cpp b/deepin-devicemanager/src/DeviceManager/DeviceInfo.cpp index 4ff8f5960..942d0b8cc 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceInfo.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceInfo.cpp @@ -935,4 +935,294 @@ const QString DeviceBaseInfo::get_string(const QString &sysPathfile) file.close(); return info; } - +//只是为了lupdate自动增加翻译而占位 +void DeviceBaseInfo::generatorTranslate() +{ + QStringList translationStrings; + translationStrings \ + << tr("Core(s)") \ + << tr("Processor") \ + << tr("ACL MTU") \ + << tr("Address") \ + << tr("Alias") \ + << tr("ansiversion") \ + << tr("Application") \ + << tr("Architecture") \ + << tr("Array Handle") \ + << tr("Asset Tag") \ + << tr("Auto Negotiation") \ + << tr("Bank Locator") \ + << tr("Base Board Information") \ + << tr("BD Address") \ + << tr("BIOS Information") \ + << tr("BIOS Revision") \ + << tr("BIOS ROMSIZE") \ + << tr("Board name") \ + << tr("BogoMIPS") \ + << tr("Boot-up State") \ + << tr("Broadcast") \ + << tr("Bus") \ + << tr("bus info") \ + << tr("Bus Info") \ + << tr("Cache Size") \ + << tr("Capabilities") \ + << tr("Capacity") \ + << tr("Characteristics") \ + << tr("Chassis Handle") \ + << tr("Chassis Information") \ + << tr("Chip") \ + << tr("Chipset") \ + << tr("Class") \ + << tr("Clock") \ + << tr("Config Status") \ + << tr("Configured Speed") \ + << tr("Configured Voltage") \ + << tr("Contained Elements") \ + << tr("Contained Object Handles") \ + << tr("copies") \ + << tr("Core ID") \ + << tr("CPU architecture") \ + << tr("CPU Family") \ + << tr("CPU ID") \ + << tr("CPU implementer") \ + << tr("CPU part") \ + << tr("CPU revision") \ + << tr("CPU variant") \ + << tr("critical-action") \ + << tr("Currently Installed Language") \ + << tr("Current Resolution") \ + << tr("daemon-version") \ + << tr("Data Width") \ + << tr("Date") \ + << tr("description") \ + << tr("Description") \ + << tr("Design Capacity") \ + << tr("Design Voltage") \ + << tr("Device") \ + << tr("Device Class") \ + << tr("Device File") \ + << tr("Device Files") \ + << tr("Device Name") \ + << tr("Device Number") \ + << tr("DigitalOutput") \ + << tr("Disable") \ + << tr("Discoverable") \ + << tr("Discovering") \ + << tr("Display Input") \ + << tr("Display Output") \ + << tr("Display Ratio") \ + << tr("DP") \ + << tr("Driver") \ + << tr("Driver Activation Cmd") \ + << tr("Driver Modules") \ + << tr("Driver Status") \ + << tr("Driver Version") \ + << tr("Duplex") \ + << tr("DVI") \ + << tr("eDP") \ + << tr("EGL client APIs") \ + << tr("EGL version") \ + << tr("energy") \ + << tr("energy-empty") \ + << tr("energy-full") \ + << tr("energy-full-design") \ + << tr("energy-rate") \ + << tr("Error Correction Type") \ + << tr("Error Information Handle") \ + << tr("EV") \ + << tr("Extensions") \ + << tr("Family") \ + << tr("Features") \ + << tr("Firmware") \ + << tr("Firmware Revision") \ + << tr("Firmware Version") \ + << tr("Flags") \ + << tr("Form Factor") \ + << tr("GDDR capacity") \ + << tr("Geometry (Logical)") \ + << tr("GLSL version") \ + << tr("GL version") \ + << tr("GPU type") \ + << tr("GPU vendor") \ + << tr("Graphics Memory") \ + << tr("guid") \ + << tr("Handlers") \ + << tr("Hardware Class") \ + << tr("has history") \ + << tr("has statistics") \ + << tr("HCI Version") \ + << tr("HDMI") \ + << tr("Height") \ + << tr("icon-name") \ + << tr("Input/Output") \ + << tr("Installable Languages") \ + << tr("Interface") \ + << tr("Interface Type") \ + << tr("ioport") \ + << tr("IO Port") \ + << tr("IP") \ + << tr("IRQ") \ + << tr("job-cancel-after") \ + << tr("job-hold-until") \ + << tr("job-priority") \ + << tr("KernelModeDriver") \ + << tr("KEY") \ + << tr("L1d Cache") \ + << tr("L1i Cache") \ + << tr("L2 Cache") \ + << tr("L3 Cache") \ + << tr("L4 Cache") \ + << tr("Language Description Format") \ + << tr("latency") \ + << tr("Latency") \ + << tr("lid-is-closed") \ + << tr("lid-is-present") \ + << tr("Link") \ + << tr("Link mode") \ + << tr("Link policy") \ + << tr("LMP Version") \ + << tr("Location") \ + << tr("Location In Chassis") \ + << tr("Locator") \ + << tr("Lock") \ + << tr("logical name") \ + << tr("Logical Name") \ + << tr("logicalsectorsize") \ + << tr("Logical Size") \ + << tr("MAC Address") \ + << tr("marker-change-time") \ + << tr("Max Frequency") \ + << tr("Maximum Capacity") \ + << tr("Maximum Current") \ + << tr("Maximum Power") \ + << tr("Maximum Rate") \ + << tr("Maximum Resolution") \ + << tr("Maximum Voltage") \ + << tr("Media Type") \ + << tr("Memory") \ + << tr("Memory Address") \ + << tr("Memory Operating Mode Capability") \ + << tr("Memory Subsystem Controller Manufacturer ID") \ + << tr("Memory Subsystem Controller Product ID") \ + << tr("Memory Technology") \ + << tr("Minimum Resolution") \ + << tr("Minimum Voltage") \ + << tr("Modalias") \ + << tr("Model") \ + << tr("Module Alias") \ + << tr("Module Alias") \ + << tr("Module Manufacturer ID") \ + << tr("Module Product ID") \ + << tr("MSC") \ + << tr("Multicast") \ + << tr("Name") \ + << tr("native-path") \ + << tr("Negotiation Rate") \ + << tr("network") \ + << tr("Non-Volatile Size") \ + << tr("Number Of Devices") \ + << tr("Number Of Power Cords") \ + << tr("number-up") \ + << tr("OEM Information") \ + << tr("on-battery") \ + << tr("online") \ + << tr("orientation-requested") \ + << tr("Packet type") \ + << tr("Pairable") \ + << tr("Part Number") \ + << tr("percentage") \ + << tr("Phys") \ + << tr("physical id") \ + << tr("Physical ID") \ + << tr("Physical Memory Array") \ + << tr("Port") \ + << tr("Powered") \ + << tr("power supply") \ + << tr("Power Supply State") \ + << tr("Primary Monitor") \ + << tr("print-color-mode") \ + << tr("printer-is-accepting-jobs") \ + << tr("printer-is-shared") \ + << tr("printer-is-temporary") \ + << tr("printer-make-and-model") \ + << tr("printer-state-change-time") \ + << tr("printer-state-reasons") \ + << tr("printer-type") \ + << tr("printer-uri-supported") \ + << tr("product") \ + << tr("Product Date") \ + << tr("Product Name") \ + << tr("PROP") \ + << tr("Rank") \ + << tr("rechargeable") \ + << tr("Refresh Rate") \ + << tr("Release date") \ + << tr("Release Date") \ + << tr("Revision") \ + << tr("ROM Size") \ + << tr("Rotation Rate") \ + << tr("Runtime Size") \ + << tr("SBDS Chemistry") \ + << tr("SBDS Manufacture Date") \ + << tr("SBDS Serial Number") \ + << tr("SBDS Version") \ + << tr("SCO MTU") \ + << tr("sectorsize") \ + << tr("Security Status") \ + << tr("Serial ID") \ + << tr("Serial Number") \ + << tr("Service Classes") \ + << tr("Set") \ + << tr("Shared") \ + << tr("sides") \ + << tr("Size") \ + << tr("SKU Number") \ + << tr("Slot") \ + << tr("SMBIOS Version") \ + << tr("state") \ + << tr("status") \ + << tr("Status") \ + << tr("Stepping") \ + << tr("SubDevice") \ + << tr("SubVendor") \ + << tr("Subversion") \ + << tr("Support Resolution") \ + << tr("Sysfs") \ + << tr("SysFS_Path") \ + << tr("System Information") \ + << tr("technology") \ + << tr("temperature") \ + << tr("Temperature") \ + << tr("Thermal State") \ + << tr("Threads") \ + << tr("Total Width") \ + << tr("Type") \ + << tr("Type Detail") \ + << tr("Unavailable") \ + << tr("Uniq") \ + << tr("updated") \ + << tr("URI") \ + << tr("UUID") \ + << tr("Vendor") \ + << tr("Version") \ + << tr("VGA") \ + << tr("Virtualization") \ + << tr("Volatile Size") \ + << tr("voltage") \ + << tr("Voltage") \ + << tr("Wake-up Type") \ + << tr("warning-level") \ + << tr("Width") \ + << tr("battery") \ + << tr("inch") \ + << tr("Architecture") \ + << tr("Frequency") \ + << tr("Max Frequency") \ + << tr("Media Type") \ + << tr("Name") \ + << tr("Size") \ + << tr("Speed") \ + << tr("Type") \ + << tr("Vendor") \ + << tr("Processor"); +} \ No newline at end of file diff --git a/deepin-devicemanager/src/DeviceManager/DeviceInfo.h b/deepin-devicemanager/src/DeviceManager/DeviceInfo.h index 6bd8fa166..a1cc20a31 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceInfo.h +++ b/deepin-devicemanager/src/DeviceManager/DeviceInfo.h @@ -491,6 +491,9 @@ class DeviceBaseInfo : public QObject */ bool PhysIDMapInfo(const QMap &mapInfo); +private: + void generatorTranslate(); + protected: QString m_Name; // Date: Tue, 3 Dec 2024 19:08:59 +0800 Subject: [PATCH 05/69] chore: extend flmx mode of device extend flmx mode of device Log: extend flmx mode of device Bug: https://pms.uniontech.com/task-view-368603.html --- .../assets/org.deepin.devicemanager.json | 4 +- .../src/DeviceManager/DeviceMemory.cpp | 4 +- .../src/DeviceManager/DeviceStorage.cpp | 4 +- .../src/DeviceManager/DeviceStorage.h | 1 + .../src/GenerateDevice/DeviceFactory.cpp | 7 +- .../src/GenerateDevice/HWGenerator.cpp | 13 -- .../src/GenerateDevice/PanguGenerator.cpp | 80 ---------- .../src/GenerateDevice/PanguGenerator.h | 26 ---- .../src/GenerateDevice/PanguVGenerator.cpp | 140 ------------------ .../src/GenerateDevice/PanguVGenerator.h | 33 ----- .../src/GenerateDevice/PanguxGenerator.cpp | 102 ------------- .../src/GenerateDevice/PanguxGenerator.h | 36 ----- .../src/Page/PageMultiInfo.cpp | 23 ++- .../deepin-devicemanager_zh_CN.ts | 18 +++ 14 files changed, 50 insertions(+), 441 deletions(-) delete mode 100644 deepin-devicemanager/src/GenerateDevice/PanguGenerator.cpp delete mode 100644 deepin-devicemanager/src/GenerateDevice/PanguGenerator.h delete mode 100644 deepin-devicemanager/src/GenerateDevice/PanguVGenerator.cpp delete mode 100644 deepin-devicemanager/src/GenerateDevice/PanguVGenerator.h delete mode 100644 deepin-devicemanager/src/GenerateDevice/PanguxGenerator.cpp delete mode 100644 deepin-devicemanager/src/GenerateDevice/PanguxGenerator.h diff --git a/deepin-devicemanager/assets/org.deepin.devicemanager.json b/deepin-devicemanager/assets/org.deepin.devicemanager.json index ee5975fb1..820f9142d 100644 --- a/deepin-devicemanager/assets/org.deepin.devicemanager.json +++ b/deepin-devicemanager/assets/org.deepin.devicemanager.json @@ -21,7 +21,7 @@ "flags": ["global"], "name": "Special Computer Type", "name[zh_CN]": "特殊机器类型", - "description": "special computer type:PGUW(value:1),KLVV/L540(value:2),KLVU(value:3),PGUV/W585(value:4),PGUX(value:5)", + "description": "special computer type:PGUW(value:1),KLVV/L540(value:2),KLVU(value:3),PGUV/W585(value:4),PGUX(value:5),FLMX(value:6)", "permissions": "readwrite", "visibility": "private" }, @@ -36,4 +36,4 @@ "visibility": "private" } } -} \ No newline at end of file +} diff --git a/deepin-devicemanager/src/DeviceManager/DeviceMemory.cpp b/deepin-devicemanager/src/DeviceManager/DeviceMemory.cpp index 94bcfab53..9df96b9ee 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceMemory.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceMemory.cpp @@ -132,7 +132,9 @@ void DeviceMemory::loadBaseDeviceInfo() { // 添加基本信息 addBaseDeviceInfo(("Name"), m_Name); - addBaseDeviceInfo(("Vendor"), m_Vendor); + if (Common::specialComType <= 0) { + addBaseDeviceInfo(("Vendor"), m_Vendor); + } addBaseDeviceInfo(("Size"), m_Size); addBaseDeviceInfo(("Type"), m_Type); addBaseDeviceInfo(("Speed"), m_Speed); diff --git a/deepin-devicemanager/src/DeviceManager/DeviceStorage.cpp b/deepin-devicemanager/src/DeviceManager/DeviceStorage.cpp index 3cefed1ed..ab742a414 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceStorage.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceStorage.cpp @@ -542,7 +542,9 @@ void DeviceStorage::loadBaseDeviceInfo() { // 添加基本信息 addBaseDeviceInfo(("Name"), m_Name); - addBaseDeviceInfo(("Vendor"), m_Vendor); + if (Common::specialComType <= 0) { + addBaseDeviceInfo(("Vendor"), m_Vendor); + } addBaseDeviceInfo(("Media Type"), translateStr(m_MediaType)); addBaseDeviceInfo(("Size"), m_Size); addBaseDeviceInfo(("Version"), m_Version); diff --git a/deepin-devicemanager/src/DeviceManager/DeviceStorage.h b/deepin-devicemanager/src/DeviceManager/DeviceStorage.h index 43f505622..6a4af6793 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceStorage.h +++ b/deepin-devicemanager/src/DeviceManager/DeviceStorage.h @@ -6,6 +6,7 @@ #ifndef DEVICESTORAGE_H #define DEVICESTORAGE_H #include"DeviceInfo.h" +#include "commonfunction.h" /** * @brief The DeviceStorage class diff --git a/deepin-devicemanager/src/GenerateDevice/DeviceFactory.cpp b/deepin-devicemanager/src/GenerateDevice/DeviceFactory.cpp index 2a77368e1..0a107937c 100644 --- a/deepin-devicemanager/src/GenerateDevice/DeviceFactory.cpp +++ b/deepin-devicemanager/src/GenerateDevice/DeviceFactory.cpp @@ -7,11 +7,8 @@ #include "X86Generator.h" #include "MipsGenerator.h" #include "ArmGenerator.h" -#include "PanguGenerator.h" -#include "PanguVGenerator.h" #include "HWGenerator.h" #include "commonfunction.h" -#include "PanguxGenerator.h" // Qt库文件 #include @@ -39,11 +36,11 @@ DeviceGenerator *DeviceFactory::getDeviceGenerator() if (type == "KLVV") generator = new HWGenerator(); else if (type == "PGUV" || type == "PGUW") - generator = new PanguVGenerator(); + generator = new HWGenerator(); else if (type == "KLVU") generator = new HWGenerator(); else if (type == "PGUX") - generator = new PanguXGenerator(); + generator = new HWGenerator(); else generator = new HWGenerator(); } else diff --git a/deepin-devicemanager/src/GenerateDevice/HWGenerator.cpp b/deepin-devicemanager/src/GenerateDevice/HWGenerator.cpp index a06420f3a..17c221b51 100644 --- a/deepin-devicemanager/src/GenerateDevice/HWGenerator.cpp +++ b/deepin-devicemanager/src/GenerateDevice/HWGenerator.cpp @@ -458,19 +458,6 @@ static void parseEDID(QStringList allEDIDS,QString input) void HWGenerator::generatorMonitorDevice() { - QMap mapInfo; - mapInfo.insert("Name", "LCD"); - mapInfo.insert("Current Resolution", "2160x1440"); - mapInfo.insert("Support Resolution", "2160x1440"); - mapInfo.insert("Size", "14 Inch"); - mapInfo.insert("Interface Type", "eDP"); - mapInfo.insert("Refresh Rate", "60Hz"); - - DeviceMonitor *monitor = new DeviceMonitor(); - monitor->setInfoFromTomlBase(mapInfo); - monitor->setInfoFromTomlOneByOne(mapInfo); - DeviceManager::instance()->addMonitor(monitor); - QString toDir = "/sys/class/drm"; QDir toDir_(toDir); diff --git a/deepin-devicemanager/src/GenerateDevice/PanguGenerator.cpp b/deepin-devicemanager/src/GenerateDevice/PanguGenerator.cpp deleted file mode 100644 index 3b226dc52..000000000 --- a/deepin-devicemanager/src/GenerateDevice/PanguGenerator.cpp +++ /dev/null @@ -1,80 +0,0 @@ -// SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -// 项目自身文件 -#include "PanguGenerator.h" - -// 其它头文件 -#include "../DeviceManager/DeviceManager.h" -#include "../DeviceManager/DeviceComputer.h" - -PanguGenerator::PanguGenerator() -{ - -} - -void PanguGenerator::generatorComputerDevice() -{ - const QList > &cmdInfo = DeviceManager::instance()->cmdInfo("cat_os_release"); - - DeviceComputer *device = new DeviceComputer(); - - // home url - if (cmdInfo.size() > 0) { - QString value = cmdInfo[0]["HOME_URL"]; - device->setHomeUrl(value.replace("\"", "")); - } - - // name type - const QList > &dmidecode1List = DeviceManager::instance()->cmdInfo("dmidecode1"); - const QList > &dmidecode2List = DeviceManager::instance()->cmdInfo("dmidecode2"); - const QList > &dmidecode3List = DeviceManager::instance()->cmdInfo("dmidecode3"); - - if (dmidecode1List.size() > 1) { - device->setVendor(dmidecode1List[1]["Manufacturer"], dmidecode2List[0]["Manufacturer"]); - device->setName(dmidecode1List[1]["Product Name"], dmidecode2List[0]["Product Name"], dmidecode1List[1]["Family"], dmidecode1List[1]["Version"]); - } - - if (dmidecode3List.size() > 1) { - device->setType(dmidecode3List[1]["Type"]); - } - - // setOsDescription - QString os = "UOS"; - DSysInfo::DeepinType type = DSysInfo::deepinType(); - if (DSysInfo::DeepinProfessional == type) - os = "UOS 20"; - else if (DSysInfo::DeepinPersonal == type) - os = "UOS 20 Home"; - else if (DSysInfo::DeepinDesktop == type) - os = "Deepin 20 Beta"; - - device->setOsDescription(os); - - // os - const QList > &verInfo = DeviceManager::instance()->cmdInfo("cat_version"); - if (verInfo.size() > 0) { - QString info = verInfo[0]["OS"].trimmed(); - info = info.trimmed(); - QRegExp reg("\\(gcc [\\s\\S]*(\\([\\s\\S]*\\))\\)", Qt::CaseSensitive); - int index = reg.indexIn(info); - if (index != -1) { - QString tmp = reg.cap(0); - info.remove(tmp); - info.insert(index, reg.cap(1)); - } - - reg.setPattern("(\\(root.*\\)) (\\(.*\\))"); - index = reg.indexIn(info); - if (index != -1) { - QString tmp = reg.cap(1); - info.remove(tmp); - } - - info.remove("version"); - device->setOS(info); - } - - DeviceManager::instance()->addComputerDevice(device); -} diff --git a/deepin-devicemanager/src/GenerateDevice/PanguGenerator.h b/deepin-devicemanager/src/GenerateDevice/PanguGenerator.h deleted file mode 100644 index 791f2c7fd..000000000 --- a/deepin-devicemanager/src/GenerateDevice/PanguGenerator.h +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -// SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#ifndef PANGUGENERATOR_H -#define PANGUGENERATOR_H -#include"DeviceGenerator.h" - -/** - * @brief The PanguGenerator class - * 将获取的设备信息生成设备对象,pangu下的生成器 - */ - -class PanguGenerator : public DeviceGenerator -{ -public: - PanguGenerator(); - - /** - * @brief generatorComputerDevice:生成概况设备信息 - */ - virtual void generatorComputerDevice() override; -}; - -#endif // PANGUGENERATOR_H diff --git a/deepin-devicemanager/src/GenerateDevice/PanguVGenerator.cpp b/deepin-devicemanager/src/GenerateDevice/PanguVGenerator.cpp deleted file mode 100644 index c8c6bc34b..000000000 --- a/deepin-devicemanager/src/GenerateDevice/PanguVGenerator.cpp +++ /dev/null @@ -1,140 +0,0 @@ -// SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -// 项目自身文件 -#include "PanguVGenerator.h" - -// 其它头文件 -#include "../DeviceManager/DeviceManager.h" -#include "../DeviceManager/DeviceMonitor.h" -#include "EDIDParser.h" -#include "DeviceManager/DeviceNetwork.h" -#include - -PanguVGenerator::PanguVGenerator() -{ - -} - -void parseEDID(QStringList allEDIDS,QString input) -{ - for (auto edid:allEDIDS) { - QProcess process; - process.start(QString("hexdump %1").arg(edid)); - process.waitForFinished(-1); - - QString deviceInfo = process.readAllStandardOutput(); - if(deviceInfo.isEmpty()) - continue; - - QString edidStr; - QStringList lines = deviceInfo.split("\n"); - for (auto line:lines) { - QStringList words = line.trimmed().split(" "); - if(words.size() != 9) - continue; - - words.removeAt(0); - QString l = words.join(""); - l.append("\n"); - edidStr.append(l); - } - - lines = edidStr.split("\n"); - if(lines.size() > 3){ - EDIDParser edidParser; - QString errorMsg; - edidParser.setEdid(edidStr,errorMsg,"\n", false); - - QMap mapInfo; - mapInfo.insert("Vendor",edidParser.vendor()); - mapInfo.insert("Date",edidParser.releaseDate()); - mapInfo.insert("Size",edidParser.screenSize()); - mapInfo.insert("Display Input",input); - - DeviceMonitor *device = new DeviceMonitor(); - device->setInfoFromEdid(mapInfo); - DeviceManager::instance()->addMonitor(device); - } - } -} - -void PanguVGenerator::generatorMonitorDevice() -{ - QStringList allEDIDS1; - allEDIDS1.append("/sys/devices/platform/hisi-drm/drm/card0/card0-HDMI-A-1/edid"); - allEDIDS1.append("/sys/devices/platform/hldrm/drm/card0/card0-HDMI-A-1/edid"); - parseEDID(allEDIDS1,"HDMI-A-1"); - - QStringList allEDIDS2; - allEDIDS2.append("/sys/devices/platform/hisi-drm/drm/card0/card0-VGA-1/edid"); - allEDIDS2.append("/sys/devices/platform/hldrm/drm/card0/card0-VGA-1/edid"); - parseEDID(allEDIDS2,"VGA-1"); -} - -void PanguVGenerator::generatorNetworkDevice() -{ - QStringList ifconfigCardName = getNetworkInfoFromifconfig(); - const QList> lstInfo = DeviceManager::instance()->cmdInfo("lshw_network"); - QList >::const_iterator it = lstInfo.begin(); - for (; it != lstInfo.end(); ++it) { - if ((*it).size() < 2) { - continue; - } - QMap tempMap = *it; - /* - capabilities: ethernet physical wireless - configuration: broadcast=yes ip=10.4.6.115 multicast=yes wireless=IEEE 802.11 - */ -// if ((tempMap["configuration"].indexOf("wireless=IEEE 802.11") > -1) || -// (tempMap["capabilities"].indexOf("wireless") > -1)) { -// continue; -// } - - QString logicalName = tempMap["logical name"].trimmed(); - if(! ifconfigCardName.contains(logicalName)) - continue; - - DeviceNetwork *device = new DeviceNetwork(); - device->setInfoFromLshw(*it); - device->setCanEnale(false); - device->setCanUninstall(false); - device->setForcedDisplay(true); - DeviceManager::instance()->addNetworkDevice(device); - } - - -} - -QStringList PanguVGenerator::getNetworkInfoFromifconfig() -{ - //通过ifconfig 判断网络是否valiate - QStringList ret; - QProcess process; - QString cmd = "ifconfig -s"; - process.start(cmd); - QString ifconfigInfo; - bool re = process.waitForFinished(-1); - if (!re) - return ret; - ifconfigInfo = process.readAllStandardOutput(); - //截取查询到的各个网卡连接信息 - QStringList list = ifconfigInfo.split("\n"); - for (int i = 1; i < list.size(); i++) { //skip Iface - //filter "lo" 网卡 - if (list.at(i).contains("lo")) - continue; - - QStringList line = list.at(i).split(" ", QString::SkipEmptyParts); - { - if(line.size() < 2) - continue; - if(line.at(0).isEmpty()) - continue; - else - ret.append(line.at(0)); - } - } - return ret; -} diff --git a/deepin-devicemanager/src/GenerateDevice/PanguVGenerator.h b/deepin-devicemanager/src/GenerateDevice/PanguVGenerator.h deleted file mode 100644 index 4532cf6d9..000000000 --- a/deepin-devicemanager/src/GenerateDevice/PanguVGenerator.h +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -// SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#ifndef PANGUVGENERATOR_H -#define PANGUVGENERATOR_H - -#include -#include "HWGenerator.h" - -/** - * @brief The PanguVGenerator class - * 将获取的设备信息生成设备对象,panguV下的生成器 - */ - -class PanguVGenerator : public HWGenerator -{ -public: - PanguVGenerator(); - - /** - * @brief generatorMonitorDevice:生成显示设备信息 - */ - virtual void generatorMonitorDevice() override; -protected: - /**@brief:generator network info*/ - virtual void generatorNetworkDevice() override; - /**@brief:generator network info*/ - virtual QStringList getNetworkInfoFromifconfig(); -}; - -#endif // PANGUVGENERATOR_H diff --git a/deepin-devicemanager/src/GenerateDevice/PanguxGenerator.cpp b/deepin-devicemanager/src/GenerateDevice/PanguxGenerator.cpp deleted file mode 100644 index 42c77cb33..000000000 --- a/deepin-devicemanager/src/GenerateDevice/PanguxGenerator.cpp +++ /dev/null @@ -1,102 +0,0 @@ -// SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -// 项目自身文件 -#include "PanguxGenerator.h" - -// 其它头文件 - -#include "../DeviceManager/DeviceAudio.h" -#include "../DeviceManager/DeviceBluetooth.h" -#include "DeviceManager/DeviceManager.h" - -PanguXGenerator::PanguXGenerator() -{ - -} - -void PanguXGenerator::getAudioInfoFromCatAudio() -{ - QMap tempMap; - tempMap["Name"] = "OnBoard Audio"; - tempMap["Vendor"]= "HUAWEI"; - DeviceAudio *device = new DeviceAudio(); - device->setCanEnale(false); - device->setCanUninstall(false); - device->setForcedDisplay(true); - device->setInfoFromCatAudio(tempMap); - DeviceManager::instance()->addAudioDevice(device); - - getAudioInfoFromHwinfo(); -} - -void PanguXGenerator::generatorBluetoothDevice() -{ - DeviceBluetooth *device0 = new DeviceBluetooth(); - QMap tempMap; - tempMap["Vendor"] = "HISILICON"; - tempMap["Name"] = "Hi1105C"; - tempMap["Model"] = "Hi1105C"; - device0->setCanEnale(false); - device0->setForcedDisplay(true); - device0->setInfoFromTomlOneByOne(tempMap); - DeviceManager::instance()->addBluetoothDevice(device0); - - const QList > lstMap = DeviceManager::instance()->cmdInfo("hwinfo_usb"); - QList >::const_iterator it = lstMap.begin(); - for (; it != lstMap.end(); ++it) { - if ((*it).size() < 1) { - continue; - } - if ((*it)["Hardware Class"] == "hub" || (*it)["Hardware Class"] == "mouse" || (*it)["Hardware Class"] == "keyboard") { - continue; - } - if ((*it)["Hardware Class"] == "bluetooth" || (*it)["Driver"] == "btusb" || (*it)["Device"] == "BCM20702A0"|| (*it)["Device"].contains("bluetooth", Qt::CaseInsensitive)) { - DeviceBluetooth *device = new DeviceBluetooth(); - device->setCanEnale(false); - device->setForcedDisplay(true); - device->setInfoFromHwinfo(*it); - DeviceManager::instance()->addBluetoothDevice(device); - - addBusIDFromHwinfo((*it)["SysFS BusID"]); - } - } -} -void PanguXGenerator::generatorCpuDevice() -{ - HWGenerator::generatorCpuDevice(); - - QFile file("/proc/cpuinfo"); - if (!file.open(QIODevice::ReadOnly)) - return; - - QMap mapInfo; - QString cpuInfo = file.readAll(); - QStringList infos = cpuInfo.split("\n\n"); - foreach (const QString &info, infos) { - if (info.isEmpty()) - continue; - - QStringList lines = info.split("\n"); - foreach (const QString &line, lines) { - if (line.isEmpty()) - continue; - QStringList words = line.split(QRegExp("[\\s]*:[\\s]*")); - if (words.size() != 2) - continue; - if ("Hardware" == words[0]) { - mapInfo.insert("Name", words[1]); - } - } - } - file.close(); - if (mapInfo.find("Name") == mapInfo.end()) - return; - - QList lst = DeviceManager::instance()->convertDeviceList(DT_Cpu); - for (int i = 0; i < lst.size(); i++) { - DeviceBaseInfo *device = lst[i]; - DeviceManager::instance()->tomlDeviceMapSet(DT_Cpu, device,mapInfo); - } -} diff --git a/deepin-devicemanager/src/GenerateDevice/PanguxGenerator.h b/deepin-devicemanager/src/GenerateDevice/PanguxGenerator.h deleted file mode 100644 index 4bd2e56b0..000000000 --- a/deepin-devicemanager/src/GenerateDevice/PanguxGenerator.h +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (C) 2019 ~ 2024 Uniontech Software Technology Co.,Ltd. -// SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#ifndef PANGUXGENERATOR_H -#define PANGUXGENERATOR_H - -#include "HWGenerator.h" - -/** - * @brief The PanguXGenerator class - * 将获取的设备信息生成设备对象,panguX下的生成器 - */ - -class PanguXGenerator : public HWGenerator -{ -public: - PanguXGenerator(); - -protected: - /** - * @brief generatorAudioDevice:生成音频适配器 - */ - virtual void getAudioInfoFromCatAudio() override; - /** - * @brief generatorBluetoothDevice:生成蓝牙设备 - */ - virtual void generatorBluetoothDevice() override; - /** - * @brief generatorCpuDevice:生成CPU设备 - */ - virtual void generatorCpuDevice() override; -}; - -#endif // PANGUXGENERATOR_H diff --git a/deepin-devicemanager/src/Page/PageMultiInfo.cpp b/deepin-devicemanager/src/Page/PageMultiInfo.cpp index 88bded31d..4e588d0b0 100644 --- a/deepin-devicemanager/src/Page/PageMultiInfo.cpp +++ b/deepin-devicemanager/src/Page/PageMultiInfo.cpp @@ -13,6 +13,7 @@ #include "DeviceInput.h" #include "DeviceNetwork.h" #include "DDLog.h" +#include "commonfunction.h" // Dtk头文件 #include @@ -87,7 +88,15 @@ void PageMultiInfo::updateInfo(const QList &lst) getTableListInfo(lst, m_deviceList, m_menuControlList); // 更新表格 + mp_Table->setVisible(true); + mp_Table->setFixedHeight(TABLE_HEIGHT); mp_Table->updateTable(m_deviceList, m_menuControlList); + if (Common::specialComType >= 1) { + if (mp_Label->text() == tr("Storage") || mp_Label->text() == tr("Memory")) { + mp_Table->setVisible(false); + mp_Table->setFixedHeight(0); + } + } // 更新详细信息 mp_Detail->showDeviceInfo(lst); @@ -122,10 +131,20 @@ void PageMultiInfo::resizeEvent(QResizeEvent *e) int curHeight = this->height(); if (curHeight < LEAST_PAGE_HEIGHT) { // 获取多个设备界面表格信息 - mp_Table->updateTable(m_deviceList, m_menuControlList, true, (LEAST_PAGE_HEIGHT - curHeight) / TREE_ROW_HEIGHT + 1); + if (Common::specialComType <= 0) { + mp_Table->updateTable(m_deviceList, m_menuControlList, true, (LEAST_PAGE_HEIGHT - curHeight) / TREE_ROW_HEIGHT + 1); + } else { + if (mp_Label->text() != tr("Storage") && mp_Label->text() != tr("Memory")) + mp_Table->updateTable(m_deviceList, m_menuControlList, true, (LEAST_PAGE_HEIGHT - curHeight) / TREE_ROW_HEIGHT + 1); + } } else { // 获取多个设备界面表格信息 - mp_Table->updateTable(m_deviceList, m_menuControlList, true, 0); + if (Common::specialComType <= 0) { + mp_Table->updateTable(m_deviceList, m_menuControlList, true, 0); + } else { + if (mp_Label->text() != tr("Storage") && mp_Label->text() != tr("Memory")) + mp_Table->updateTable(m_deviceList, m_menuControlList, true, 0); + } } return PageInfo::resizeEvent(e); diff --git a/deepin-devicemanager/translations/deepin-devicemanager_zh_CN.ts b/deepin-devicemanager/translations/deepin-devicemanager_zh_CN.ts index 0896238af..336a0fb78 100644 --- a/deepin-devicemanager/translations/deepin-devicemanager_zh_CN.ts +++ b/deepin-devicemanager/translations/deepin-devicemanager_zh_CN.ts @@ -766,6 +766,24 @@ PageMultiInfo + + + + + + + Storage + 存储设备 + + + + + + + + Memory + 内存 + Failed to enable the device From 4d4e3f75a87deee50f96b4b0f705facc2e7b9ffc Mon Sep 17 00:00:00 2001 From: zhanghongyuan Date: Sat, 7 Dec 2024 10:03:21 +0800 Subject: [PATCH 06/69] fix: the flmx device of monitor display fix the flmx device of monitor display Log: fix the flmx device of monitor display Task: https://pms.uniontech.com/task-view-368603.html --- deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp b/deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp index 855474618..67d9e21dc 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp @@ -125,7 +125,8 @@ void DeviceMonitor::setInfoFromHwinfo(const QMap &mapInfo) TomlFixMethod DeviceMonitor::setInfoFromTomlOneByOne(const QMap &mapInfo) { - m_IsTomlSet = true; + if (Common::specialComType == 2) + m_IsTomlSet = true; TomlFixMethod ret = TOML_None; // 添加基本信息 ret = setTomlAttribute(mapInfo, "Type", m_Model); From 958f62c727bd2c6d3a9828c6c55650dcd9557083 Mon Sep 17 00:00:00 2001 From: zhanghongyuan Date: Sat, 7 Dec 2024 11:23:50 +0800 Subject: [PATCH 07/69] fix: the pgux device of monitor display fix the pgux device of monitor display Log: fix the pgux device of monitor display Task: https://pms.uniontech.com/task-view-368603.html --- deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp b/deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp index 67d9e21dc..ce7bf204b 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp @@ -319,7 +319,11 @@ bool DeviceMonitor::setMainInfoFromXrandr(const QString &info, const QString &ra if (pos > 0 && curRate.size() > pos && !Common::boardVendorType().isEmpty()) { curRate = QString::number(ceil(curRate.left(pos).toDouble())) + curRate.right(curRate.size() - pos); } - m_CurrentResolution = QString("%1@%2").arg(reScreenSize.cap(1)).arg(curRate); + if (Common::specialComType == 5) { + m_CurrentResolution = QString("%1").arg(reScreenSize.cap(1)); + } else { + m_CurrentResolution = QString("%1@%2").arg(reScreenSize.cap(1)).arg(curRate); + } } else m_CurrentResolution = QString("%1").arg(reScreenSize.cap(1)); } From ed96373b99604dec0f468fe88e359a0f6ddcfc27 Mon Sep 17 00:00:00 2001 From: zhanghongyuan Date: Mon, 9 Dec 2024 09:54:16 +0800 Subject: [PATCH 08/69] fix: get the network of usb vender info get the network of usb vender info Log: get the network of usb vender info Task: https://pms.uniontech.com/task-view-368603.html --- .../src/DeviceManager/DeviceInfo.cpp | 24 ++++++++++++++- .../src/DeviceManager/DeviceInfo.h | 8 +++++ .../src/DeviceManager/DeviceNetwork.cpp | 30 ++++--------------- 3 files changed, 37 insertions(+), 25 deletions(-) diff --git a/deepin-devicemanager/src/DeviceManager/DeviceInfo.cpp b/deepin-devicemanager/src/DeviceManager/DeviceInfo.cpp index 942d0b8cc..6e6331d86 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceInfo.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceInfo.cpp @@ -630,6 +630,28 @@ const QString DeviceBaseInfo::getVendorOrModelId(const QString &sysPath, bool fl return vendor; } +void DeviceBaseInfo::setVendorNameBylsusbLspci(const QString &vidpid, const QString &modalias) +{ + if (!vidpid.isEmpty() && modalias.contains("usb")) { + QProcess process; + QString vendorId = vidpid.toLower().remove("0x").trimmed().left(4); + QString deviceId = vidpid.toLower().remove("0x").trimmed().right(4); + process.start("lsusb -v -d " + vendorId + ":" + deviceId); + process.waitForFinished(-1); + + QString output = process.readAllStandardOutput(); + + foreach (QString out, output.split("\n")) { + // 从USB设备获取制造商和设备名称 + if (out.contains("idVendor", Qt::CaseSensitive)) { + m_Vendor = out.remove(0, out.indexOf(vendorId) + 4).trimmed(); + } else if (out.contains("idProduct", Qt::CaseSensitive)) { + m_Name = out.remove(0, out.indexOf(deviceId) + 4).trimmed(); + } + } + } +} + const QString DeviceBaseInfo::getDriverVersion() { QString outInfo = Common::executeClientCmd("modinfo", QStringList() << driver(), QString(), -1); @@ -1225,4 +1247,4 @@ void DeviceBaseInfo::generatorTranslate() << tr("Type") \ << tr("Vendor") \ << tr("Processor"); -} \ No newline at end of file +} diff --git a/deepin-devicemanager/src/DeviceManager/DeviceInfo.h b/deepin-devicemanager/src/DeviceManager/DeviceInfo.h index a1cc20a31..bd975caa0 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceInfo.h +++ b/deepin-devicemanager/src/DeviceManager/DeviceInfo.h @@ -224,6 +224,14 @@ class DeviceBaseInfo : public QObject */ const QString getVendorOrModelId(const QString &sysPath, bool flag = true); + /** + * @brief setVendorNameBylsusbLspci:获取Vendor 和 Name + * @param vidpid 属性vidpid + * @param modalias + * @return + */ + void setVendorNameBylsusbLspci(const QString &vidpid, const QString &modalias); + /** * @brief get_string:读取文件内信息 * @param path:文件绝对路径+名称 diff --git a/deepin-devicemanager/src/DeviceManager/DeviceNetwork.cpp b/deepin-devicemanager/src/DeviceManager/DeviceNetwork.cpp index 27fbe40f5..b082a6794 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceNetwork.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceNetwork.cpp @@ -50,28 +50,8 @@ void DeviceNetwork::setInfoFromLshw(const QMap &mapInfo) setAttribute(mapInfo, "description", m_Model); setAttribute(mapInfo, "product", m_Name); setAttribute(mapInfo, "vendor", m_Vendor); - if (m_SysPath.contains("usb")) { - QProcess process; - QString vendorId = getVendorOrModelId(m_SysPath, true).trimmed(); - QString deviceId = getVendorOrModelId(m_SysPath, false).trimmed(); - process.start("lsusb -v -d " + vendorId + ":" + deviceId); - process.waitForFinished(-1); - - QString output = process.readAllStandardOutput(); - - foreach (QString out, output.split("\n")) { - if (!m_Vendor.isEmpty() && !m_Name.isEmpty()) - break; - // 从USB设备获取制造商和设备名称 - if (m_Vendor.isEmpty() && out.contains("idVendor", Qt::CaseSensitive)) { - m_Vendor = out.remove(0, out.indexOf(vendorId) + 4).trimmed(); - } else if (m_Name.isEmpty() && out.contains("idProduct", Qt::CaseSensitive)) { - m_Name = out.remove(0, out.indexOf(deviceId) + 4).trimmed(); - } - } - } else { - setAttribute(mapInfo, "description", m_Name, false); - } + setAttribute(mapInfo, "description", m_Name); + setAttribute(mapInfo, "version", m_Version); setAttribute(mapInfo, "bus info", m_BusInfo); setAttribute(mapInfo, "logical name", m_LogicalName); @@ -153,6 +133,7 @@ bool DeviceNetwork::setInfoFromHwinfo(const QMap &mapInfo) return true; } setAttribute(mapInfo, "Device", m_Name); + setAttribute(mapInfo, "Vendor", m_Vendor); setAttribute(mapInfo, "Device File", m_LogicalName); setAttribute(mapInfo, "HW Address", m_MACAddress); setAttribute(mapInfo, "Permanent HW Address", m_UniqueID); @@ -162,6 +143,9 @@ bool DeviceNetwork::setInfoFromHwinfo(const QMap &mapInfo) setAttribute(mapInfo, "Module Alias", m_Modalias); setAttribute(mapInfo, "VID_PID", m_VID_PID); m_PhysID = m_VID_PID; + if (!m_VID_PID.isEmpty() && m_Modalias.contains("usb")) { + setVendorNameBylsusbLspci(m_VID_PID, m_Modalias); + } if (driverIsKernelIn(m_DriverModules) || driverIsKernelIn(m_Driver)) { m_CanUninstall = false; @@ -175,8 +159,6 @@ bool DeviceNetwork::setInfoFromHwinfo(const QMap &mapInfo) // 判断是否是无线网卡 setIsWireless(mapInfo["SysFS ID"]); - setHwinfoLshwKey(mapInfo); - return true; } From da8e00966728b8d16b4c0aac76f512c822bb5516 Mon Sep 17 00:00:00 2001 From: shuaijie Date: Tue, 10 Dec 2024 14:05:47 +0800 Subject: [PATCH 09/69] fix: [network] add communication network support add communication network support Log: add communication network support Bug: https://pms.uniontech.com/task-view-360593.html --- deepin-devicemanager/src/GenerateDevice/CmdTool.cpp | 2 +- deepin-devicemanager/src/GenerateDevice/DeviceGenerator.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/deepin-devicemanager/src/GenerateDevice/CmdTool.cpp b/deepin-devicemanager/src/GenerateDevice/CmdTool.cpp index 98a62038d..d21582547 100644 --- a/deepin-devicemanager/src/GenerateDevice/CmdTool.cpp +++ b/deepin-devicemanager/src/GenerateDevice/CmdTool.cpp @@ -331,7 +331,7 @@ void CmdTool::loadLshwInfo(const QString &debugFile) } else if (item.startsWith("multimedia")) { // 音频信息 getMapInfoFromLshw(item, mapInfo); addMapInfo("lshw_multimedia", mapInfo); - } else if (item.startsWith("network")) { // 网卡信息 + } else if (item.startsWith("network") || item.startsWith("communication")) { // 网卡信息 getMapInfoFromLshw(item, mapInfo); addMapInfo("lshw_network", mapInfo); } else if (item.startsWith("usb")) { // USB 设备信息 diff --git a/deepin-devicemanager/src/GenerateDevice/DeviceGenerator.cpp b/deepin-devicemanager/src/GenerateDevice/DeviceGenerator.cpp index 5dfe2d885..8488410cf 100644 --- a/deepin-devicemanager/src/GenerateDevice/DeviceGenerator.cpp +++ b/deepin-devicemanager/src/GenerateDevice/DeviceGenerator.cpp @@ -249,7 +249,7 @@ void DeviceGenerator::generatorMonitorDevice() bool isValidLogicalName(const QString& logicalName) { - if (logicalName.contains("p2p", Qt::CaseInsensitive)) + if (logicalName.contains("p2p", Qt::CaseInsensitive) || logicalName.isEmpty()) return false; QString addressFilePath = "/sys/class/net/" + logicalName; From 093ad2adff8439d9ab2d9f962625ec884acb7177 Mon Sep 17 00:00:00 2001 From: shuaijie Date: Thu, 12 Dec 2024 10:02:49 +0800 Subject: [PATCH 10/69] fix: [network] add communication network support add communication network support Log: add communication network support Bug: https://pms.uniontech.com/task-view-360593.html --- deepin-devicemanager/src/DeviceManager/DeviceNetwork.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/deepin-devicemanager/src/DeviceManager/DeviceNetwork.cpp b/deepin-devicemanager/src/DeviceManager/DeviceNetwork.cpp index b082a6794..805bdee55 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceNetwork.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceNetwork.cpp @@ -50,7 +50,8 @@ void DeviceNetwork::setInfoFromLshw(const QMap &mapInfo) setAttribute(mapInfo, "description", m_Model); setAttribute(mapInfo, "product", m_Name); setAttribute(mapInfo, "vendor", m_Vendor); - setAttribute(mapInfo, "description", m_Name); + if (m_Name.isEmpty()) + setAttribute(mapInfo, "description", m_Name); setAttribute(mapInfo, "version", m_Version); setAttribute(mapInfo, "bus info", m_BusInfo); From d6a9c9f561ed018b87ef222a924cb397e9abfaa2 Mon Sep 17 00:00:00 2001 From: zhanghongyuan Date: Tue, 17 Dec 2024 15:35:34 +0800 Subject: [PATCH 11/69] fix: the w515 device of monitor display fix the w515 device of monitor display Log: fix the w515 device of monitor display Task: https://pms.uniontech.com/task-view-368603.html --- .../src/DeviceManager/DeviceMonitor.cpp | 10 + .../deepin-devicemanager_zh_CN.ts | 4469 +++++++++-------- 2 files changed, 2251 insertions(+), 2228 deletions(-) diff --git a/deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp b/deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp index ce7bf204b..f40512508 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp @@ -33,6 +33,7 @@ DeviceMonitor::DeviceMonitor() , m_CurrentResolution("") , m_SerialNumber("") , m_ProductionWeek("") + , m_RefreshRate("") , m_Width(0) , m_Height(0) , m_IsTomlSet(false) @@ -275,6 +276,15 @@ void DeviceMonitor::loadOtherDeviceInfo() if (m_CurrentResolution != "@Hz") { addOtherDeviceInfo(("Current Resolution"), m_CurrentResolution); addOtherDeviceInfo(("Display Ratio"), m_AspectRatio); + + if (Common::specialComType == 4) { + if (m_CurrentResolution.contains("@")) { + QStringList refreshList = m_CurrentResolution.split('@', QString::SkipEmptyParts); + if (refreshList.size() == 2) { + m_RefreshRate = refreshList.at(1).trimmed(); + } + } + } } addOtherDeviceInfo(("Primary Monitor"), m_MainScreen); addOtherDeviceInfo(("Size"), m_ScreenSize); diff --git a/deepin-devicemanager/translations/deepin-devicemanager_zh_CN.ts b/deepin-devicemanager/translations/deepin-devicemanager_zh_CN.ts index 336a0fb78..3b2c84748 100644 --- a/deepin-devicemanager/translations/deepin-devicemanager_zh_CN.ts +++ b/deepin-devicemanager/translations/deepin-devicemanager_zh_CN.ts @@ -4,17 +4,17 @@ BtnLabel - + OK 确 定 - + Feedback 反馈 - + OK button 确 定 @@ -31,17 +31,17 @@ CommonTools - + EC_NOTIFY_NETWORK EC_NOTIFY_NETWORK - + EC_REINSTALL EC_REINSTALL - + EC_6 EC_6 @@ -90,3277 +90,3290 @@ - DeviceManager + DeviceBaseInfo - - - - - - - - - - - Overview - 概况 + One + - - - - CPU - 处理器 + Two + - - - CPU quantity - CPU数量 + Four + - - - Motherboard - 主板 + Six + - - - Memory - 内存 + Eight + - - - Display Adapter - 显示适配器 + Nine + - - - Sound Adapter - 音频适配器 + Ten + - - - Storage - 存储设备 + Twelve + 十二 - - - Other PCI Devices - 其他PCI设备 + Fourteen + 十四 - - - Battery - 电池 + Sixteen + 十六 - - - Bluetooth - 蓝牙 + Eighteen + 十八 - - - Network Adapter - 网络适配器 + Twenty + 二十 - - - Mouse - 鼠标 + Twenty-two + 二十二 - - - Keyboard - 键盘 + Twenty-four + 二十四 - - - Monitor - 显示设备 + Twenty-six + 二十六 - - - CD-ROM - 光驱 + Twenty-eight + 二十八 - - - Printer - 打印机 + Thirty + 三十 - - - Camera - 图像设备 + Thirty-two + 三十二 - - - Other Devices - Other Input Devices - 其他设备 + Thirty-four + 三十四 - - - - Device - 设备 + Thirty-six + 三十六 - - - - OS - 操作系统 + Thirty-eight + 三十八 - - - GetDriverNameWidget - - - Select a driver for update - 选择需要更新的驱动程序 + Forty + 四十 - - No drivers found in this folder - 所选文件夹未检测到驱动文件 + Forty-two + 四十二 - - - GetInfoPool - - Loading Audio Device Info... - 获取音频设备信息... + Forty-four + 四十四 - - Loading BIOS Info... - 获取BIOS信息... + Forty-six + 四十六 - - Loading CD-ROM Info... - 获取光驱信息... + Forty-eight + 四十八 - - Loading Operating System Info... - 获取操作系统信息... + Fifty + 五十 - - Loading CPU Info... - 获取处理器信息... + Fifty-two + 五十二 - - Loading Other Devices Info... - 获取其他设备信息... + Fifty-four + 五十四 - - Loading Power Info... - 获取电池信息... + Fifty-six + 五十六 - - Loading Printer Info... - 获取打印机信息... + Fifty-eight + 五十八 - - Loading Mouse Info... - 获取鼠标信息... + Sixty + 六十 - - Loading Network Adapter Info... - 获取网络适配器信息... + Sixty-two + 六十二 - - - LogTreeView - - - - Disable - 禁用 + Sixty-four + 六十四 - - Unavailable - 不可用 + Sixty-six + 六十六 - - - LogViewItemDelegate - - Disable - 禁用 + Sixty-eight + 六十八 - - Unavailable - 不可用 + Seventy + 七十 - - - MainWindow - - Device Info - export file's name - 设备信息 + Seventy-two + 七十二 - - Display shortcuts - 显示快捷键 + Seventy-four + 七十四 - - Close - 关闭 + Seventy-six + 七十六 - - Help - 帮助 + Seventy-eight + 七十八 - - Copy - 复制 + Eighty + 八十 - - System - 系统 + Eighty-two + 八十二 - - Export - 导出 + Eighty-four + 八十四 - - Refresh - 刷新 + Eighty-six + 八十六 - - Device Manager - 设备管理器 + Eighty-eight + 八十八 - - Hardware - 硬件信息 + Ninety + 九十 - - Drivers - 驱动管理 + Ninety-two + 九十二 - - Monitor - 显示设备 + Ninety-four + 九十四 - - Overview - 概况 + Ninety-six + 九十六 - - Display Adapter - 显示适配器 + Ninety-eight + 九十八 - - CPU - 处理器 + One hundred + 一百 - - Network Adapter - 网络适配器 + One hundred and Two + 一百零二 - - Battery - 电池 + One hundred and four + 一百零四 - - - PageDetail - - More - 更多 + One hundred and Six + 一百零六 - - - PageDriverBackupInfo - - - Name - 名称 + One hundred and Eight + 一百零八 - - - Current Version - 当前版本 + One hundred and Ten + 一百一十 - - - Driver Platform Version - 驱动平台版本 + One hundred and Twelve + 一百一十二 - - Status - 状态 + One hundred and Fourteen + 一百一十四 - - Action - 操作 + One hundred and Sixteen + 一百一十六 - - Backupable Drivers - 可备份驱动 + One hundred and Eighteen + 一百一十八 - - Backed up Drivers - 已备份驱动 + One hundred and Twenty + 一百二十 - - - PageDriverControl - - - Updating - 正在更新 + One hundred and Twenty-two + 一百二十二 - - - - Cancel - button - 取 消 + One hundred and Twenty-four + 一百二十四 - - Next - 下一步 + One hundred and Twenty-six + 一百二十六 - - Warning - 注意 + One hundred and Twenty-eight + 一百二十八 - - The device will be unavailable after the driver uninstallation - 将从系统中卸载此驱动程序,卸载后该设备不可用 + One hundred and Ninety-two + 一百九十二 - - Uninstall - button - 卸 载 + Two hundred and fifty-six + 二百五十六 - - Uninstalling - 正在卸载 + + Device Name + 设备名称 - - Update successful - 驱动更新成功 + + + Vendor + 制造商 - - Uninstallation successful - 驱动卸载成功 + + Chip + 芯片 - - Update failed - 驱动更新失败 + + Physical ID + 物理ID - - Uninstallation failed - 驱动卸载失败 + + SysFS_Path + - - OK - button - 确 定 + + Revision + - - Next - button - 下一步 + + KernelModeDriver + - - The selected folder does not exist, please select again - 所选文件夹不存在,请重新选择 + + IRQ + 中断 - - Update - button - 更 新 + + Disable + 禁用 - - Previous - button - 上一步 + + Version + 版本 - - Broken package - 包文件损坏 + + Chipset + 芯片组 - - Unmatched package architecture - 包文件与系统架构不匹配 + + + Module Alias + 模块别名 - - - The selected file does not exist, please select again - 所选文件不存在,请重新选择 + + Speed + 速度 - - It is not a driver - 该文件不是驱动文件 + + Maximum Power + 最大功率 - - Unable to install - no digital signature - 无法安装,安装包无数字签名 + + Driver + 驱动 - - Unknown error - 未知错误 + + Driver Version + 驱动版本 - - The driver module was not found - 未发现该驱动模块 + + Capabilities + 功能 - - Invalid module format - 模块格式无效 + + logical name + 逻辑名称 - - The driver module has dependencies - 驱动模块被依赖 + + Logical Name + 逻辑名称 - - - PageDriverInstallInfo - - - - Device Name - 设备名称 + + MAC Address + 物理地址 - - Version Available - 可安装版本 + + CPU ID + 处理器ID - - - Size - 大小 + + Core ID + 核心ID - - - Status - 状态 + + Threads + 线程数 - - - Action - 操作 + + BogoMIPS + 运行速度(Bogomips) - - New Version - 可更新版本 + + + Architecture + 架构 - - Current Version - 当前版本 + + CPU Family + 家族 - - Missing drivers (%1) - 可安装驱动 (%1) + + + Processor + 逻辑处理器 - - Outdated drivers (%1) - 可更新驱动 (%1) + + Core(s) + - - Up-to-date drivers (%1) - 无需更新驱动 (%1) - - - - PageDriverManager + + Virtualization + 虚拟化 + - - - - Driver Install - 驱动安装 + + Flags + 特性 - - - - - Driver Backup - 驱动备份 + + Extensions + 扩展指令集 - - - Driver Restore - 驱动还原 + + L3 Cache + L3缓存 - - OK - 确 定 + + L4 Cache + L4缓存 - - Feedback - 反馈 + + L2 Cache + L2缓存 - - - PageDriverRestoreInfo - - You do not have any drivers to restore, please backup first - 您没有驱动可以还原,请先备份 + + L1i Cache + L1缓存(指令) - - Go to Backup Driver - 前往备份驱动 + + L1d Cache + L1缓存(数据) - - Name - 名称 + + Stepping + 步进 - - Current Version - 当前版本 + + Frequency + 频率 - - Backup Version - 备份版本 + + + Max Frequency + 最大频率 - - Action - 操作 + + Graphics Memory + 显存 - - Restorable Drivers - 可还原驱动 + + Memory Address + 内存地址 - - - PageListView - - Refresh - 刷新 + + IO Port + I/O端口 - - Export - 导出 + + Maximum Resolution + 最大分辨率 - - Overview - 概况 + + Minimum Resolution + 最小分辨率 - - Driver Install - 驱动安装 + + Description + 描述 - - Driver Backup - 驱动备份 + + DP + DP - - Driver Restore - 驱动还原 + + eDP + eDP - - - PageMultiInfo - - - - - - Storage - 存储设备 + + HDMI + HDMI - - - - - - Memory - 内存 + + temperature + - - Failed to enable the device - 启用失败 + + Type Detail + - - Failed to disable the device - 禁用失败 + + VGA + VGA - - Failed to disable it: unable to get the device SN - 无法获取设备序列号,禁用失败 + + DVI + DVI - - Update Drivers - 更新驱动 + + DigitalOutput + DigitalOutput - - Uninstall Drivers - 卸载驱动 + + Display Output + 显示输出 - - - PageOverview - - Refresh - 刷新 + + Interface + 接口 - - Export - 导出 + + Bus Info + 总线信息 - - Copy - 复制 + + bus info + 总线信息 - - Overview - 概况 + + Maximum Current + 最大电流 - - - PageSingleInfo - - Refresh - 刷新 + + Unavailable + 不可用 - - Export - 导出 + + + Type + 类型 - - Copy - 复制 + + Total Width + 总位宽 - - - Enable - 启用 + + Locator + 插槽 - - Update drivers - 更新驱动 + + Configured Voltage + 配置电压 - - Uninstall drivers - 卸载驱动 + + Maximum Voltage + 最高电压 - - Allow it to wake the computer - 允许唤起电脑 + + Minimum Voltage + 最低电压 - - Disable - 禁用 + + Configured Speed + 配置速度 - - - Failed to disable it: unable to get the device SN - 无法获取设备序列号,禁用失败 + + Data Width + 数据位宽 - - Failed to disable the device - 禁用失败 + + Display Input + 显示输入 - - Failed to enable the device - 启用失败 + + Interface Type + 接口类型 - - Update Drivers - 更新驱动 + + Support Resolution + 支持分辨率 - - Uninstall Drivers - 卸载驱动 + + Current Resolution + 当前分辨率 - - - TableWidget - - - Disable - 禁用 + + Refresh Rate + 刷新率 - - Refresh - 刷新 + + Display Ratio + 显示比例 - - Export - 导出 + + Primary Monitor + 主显示器 - - Update drivers - 更新驱动 + + + Size + 大小 - - Uninstall drivers - 卸载驱动 + + Maximum Rate + 最大速率 - - Allow it to wake the computer - 允许唤起电脑 + + Negotiation Rate + 协商速率 - - - Enable - 启用 + + Port + 端口 - - - - TextBrowser - - Refresh - 刷新 + + Multicast + 组播 - - Export - 导出 + + Link + 连接 - - Copy - 复制 + + Latency + 延迟 - - Disable - 禁用 + + IP + IP - - Unavailable - 不可用 + + Firmware + 固件 - - - UrlChooserEdit - - Select a local folder please - 请选择本地文件夹 + + Duplex + 双工 - - - WaitingWidget - - Loading... - 正在载入... + + Broadcast + 广播 - - -QObject - - - - - CPU - 处理器 + + Auto Negotiation + 自动协商 - - - - - No CPU found - 未发现处理器 + + Input/Output + 输入/输出 - - - - - Motherboard - 主板 + + Memory + 内存 - - - - - No motherboard found - 未发现主板 + + Model + 型号 - - - - - No memory found - 未发现内存 + + Status + 状态 - - - - - Storage - 存储设备 + + Capacity + 最大容量 - - - - - No disk found - 未发现磁盘 + + Voltage + 电压 - - Driver restore failed! - 驱动还原失败! + + Slot + 插槽 - - - Please try again or give us feedback - 请重试,或反馈给我们 + + Design Capacity + 设计容量 - - Driver backup failed! - 驱动备份失败! + + Design Voltage + 设计电压 - - - - - - Display Adapter - 显示适配器 + + SBDS Version + SBDS版本 - - - - - No GPU found - 未发现GPU + + SBDS Serial Number + SBDS序列号 - - - - - Monitor - 显示设备 + + SBDS Manufacture Date + SBDS制造日期 - - - - - No monitor found - 未发现显示设备 + + SBDS Chemistry + SBDS材料 - - - - - - Network Adapter - 网络适配器 + + Temperature + 温度 - - - - - No network adapter found - 未发现网络适配器 + + + Name + 名称 - - - - - - Sound Adapter - 音频适配器 + + Shared + 已共享 - - - - - No audio device found - 未发现音频设备 + + URI + URI - - - - - - Bluetooth - 蓝牙 + + + Media Type + 介质类型 - - - - - No Bluetooth device found - 未发现蓝牙设备 + + Firmware Version + 固件版本 - - - - - Other PCI Devices - 其他PCI设备 + + Serial Number + 序列号 - - - - - No other PCI devices found - 未发现其他PCI设备 + + Rotation Rate + 转速 - - - - - Power - 电池 + + SubVendor + 子制造商 - - - - - No battery found - 未发现电池 + + SubDevice + 子设备 - - - - - - Keyboard - 键盘 + + Driver Status + 驱动状态 - - - - - No keyboard found - 未发现键盘 + + Config Status + 配置状态 - - - - - - Mouse - 鼠标 + + Phys + Phys - - - - - No mouse found - 未发现鼠标 + + Sysfs + Sysfs - - - - - - - Printer - 打印机 + + Handlers + 处理程序 - - - - - No printer found - 未发现打印机 + + PROP + PROP - - - - - Camera - 图像设备 + + EV + EV - - - - - No camera found - 未发现图像设备 + + KEY + KEY - - - - - CD-ROM - 光驱 + + Bus + 总线 - - - - - No CD-ROM found - 未发现光驱 + + BIOS Information + BIOS信息 - - - - - - Other Devices - 其他设备 + + Base Board Information + 主板信息 - - - - - No other devices found - 未发现其他设备 + + System Information + 系统信息 - - - Device Manager - 设备管理器 + + Chassis Information + 机箱信息 - - Device Manager is a handy tool for viewing hardware information and managing the devices. - 设备管理器是查看、管理硬件设备的工具软件。 + + Physical Memory Array + 内存插槽信息 - - New drivers available! Install or update them now. - 您有驱动可进行安装/更新 + + Release Date + 发布日期 - - View - 查看 + + Address + 地址 - - Include subfolders - 包括子文件夹 + + Runtime Size + 运行内存大小 - - Search for drivers in this path - 选择驱动所在位置 + + ROM Size + ROM大小 - - %1 driver updates available - 发现%1个驱动可安装更新 + + Characteristics + 特性 - - - Time checked: %1 - 检测时间: %1 + + BIOS Revision + BIOS修订版本 - - Downloading drivers for %1... - 正在下载%1驱动… + + Firmware Revision + 固件修订版本 - - Download speed: %1 Downloaded %2/%3 - 下载速度:%1 已完成 %2/%3 + + Product Name + 产品名称 - - Installing drivers for %1... - 正在安装%1驱动… + + Asset Tag + 资产编号 - - %1 drivers installed, %2 drivers failed - 驱动安装成功%1个,失败%2个 + + Features + 特征 - - %1 drivers installed - 共成功安装%1个驱动 + + Location In Chassis + 机箱内位置 - - Failed to install drivers - 驱动安装失败 + + Chassis Handle + 机箱程序 - - Network error. Reconnecting... - 网络异常,重试中 + + Contained Object Handles + 包含对象程序 - - Download speed: %1 - 下载速度:%1 + + UUID + UUID - - Your drivers are up to date - 驱动已是最新 + + Wake-up Type + 唤醒类型 - - All drivers have been backed up - 驱动已全部备份 + + SKU Number + SKU号 - - - A total of %1 drivers, of which %2 have been backed up - 总计%1个驱动,其中%2个已备份 + + Family + 家族 - - You have %1 drivers that can be backed up, it is recommended to do so immediately - 您有%1个驱动可以备份,建议立即备份 + + Lock + - - You have %1 drivers that can be backed up - 您有%1个驱动可以备份 + + Boot-up State + 开机状态 - - Backing up the %1 driver, a total of %2 drivers - 正在备份第%1个驱动,共%2个 + + Power Supply State + 供电状态 - - Backing up: %1 - 正在备份:%1 + + Thermal State + 散热状态 - - %1 drivers backed up, %2 drivers failed - 驱动备份成功%1个,失败%2个 + + Security Status + 安全状态 - - Failed to backup drivers - 备份失败 + + OEM Information + OEM信息 - - %1 drivers backed up - %1个驱动已备份 + + Height + 高度 - - You have %1 drivers that can be restored - 您有%1个驱动可以还原 + + Number Of Power Cords + 电源线数 - - Please select a driver to restore - 请选择驱动还原 + + Contained Elements + 包含组件数 - - Driver is restoring... - 驱动还原中… + + Location + 位置 - - Restoring: %1 - 正在还原:%1 + + Error Correction Type + 纠错类型 - - reboot - 重启电脑 + + Maximum Capacity + 最大容量 - - Please %1 for the installed drivers to take effect - 驱动已安装完成,请稍后%1生效 + + Error Information Handle + 错误信息程序 - - View backup path - 查看备份路径 + + Number Of Devices + 卡槽数量 - - Backup All - 一键备份 + + BIOS ROMSIZE + BIOS ROM大小 - - - submit feedback - 反馈 + + Release date + 发布日期 - - Please try again or %1 to us - 驱动未安装成功,请重试或%1给我们 + + Board name + 主板名称 - - Install All - 一键安装 + + SMBIOS Version + SMBIOS版本 - - - Scan Again - 重新检测 + + Language Description Format + 语言描述格式 - - Cancel - 取 消 + + Installable Languages + 可安装语言数 - - Scanning hardware device drivers, please wait... - 正在进行硬件驱动扫描,请耐心等待... + + Currently Installed Language + 当前安装语言 - - - Scanning %1 - 正在扫描%1 + + BD Address + 蓝牙设备地址 - - Scan failed - 检测失败 + + ACL MTU + ACL MTU - - Network unavailable - 无网络 + + SCO MTU + SCO MTU - - Please check your network connection - 请检查网络连接 + + Packet type + 数据包类型 - - Please scan again or %1 to us - 请重新检测或%1给我们 + + Link policy + 连接策略 - - You are installing a driver, which will be interrupted if you exit. - 当前正在安装驱动,退出应用后任务将会中断 + + Link mode + 连接模式 - - - - Are you sure you want to exit? - 确认是否退出应用? + + Class + 类别 - - - - Exit - button - 退 出 + + Service Classes + 服务类别 - - - - Cancel - button - 取 消 + + Device Class + 设备类别 - - You are backing up drivers, which will be interrupted if you exit. - 当前正在备份驱动,退出应用后任务将会中断 + + HCI Version + HCI版本 - - You are restoring drivers, which will be interrupted if you exit. - 当前正在还原驱动,退出应用后任务将会中断 + + LMP Version + LMP版本 - - Bluetooth adapter - 蓝牙适配器 + + Subversion + 子版本 - - - Imaging device - 图像设备 + + Device + 设备 - - Display adapter - 显卡 + + Serial ID + 序列号 - - Sound card - 声卡 + + product + 产品 - - Network adapter - 网卡 + + Powered + 供电 - - Wireless network adapter - 无线网卡 + + Discoverable + 可发现 - - Installation successful - 安装成功 + + Pairable + 可配对 - - Installation failed - 安装失败 + + Modalias + 设置命令别名 - - Downloading - 下载中 + + Discovering + 搜索中 - - Installing - 安装中 + + Device File + 设备文件 - - Not installed - 驱动未安装 + + Device Files + 设备文件 - - Out-of-date - 驱动可更新 + + Device Number + 设备编号 - - Waiting - 等待中 + + Application + 应用 - - Not backed up - 驱动未备份 + + ansiversion + ANSI版本 - - Backing up - 正在备份 + + CPU implementer + CPU程序 - - Backup failed - 备份失败 + + CPU architecture + CPU架构 - - Backup successful - 备份成功 + + CPU variant + CPU变量 - - Restoring - 还原中 + + CPU part + CPU部件 - - Unknown error - 未知错误 + + CPU revision + CPU版本 - - Network error - 网络异常 + + GDDR capacity + GDDR容量 - - Canceled - 已取消 + + GPU vendor + GPU供应商 - - Failed to get driver files - 驱动文件获取异常 + + GPU type + GPU类型 - - Update - 更新 + + EGL version + EGL版本 - - Backup - 备份 + + EGL client APIs + EGL接口 - - Restore - 还原 + + GL version + GL版本 - - Install - 安装 + + GLSL version + GLSL版本 - - - DeviceBaseInfo - - One - + Unknown + 未知 - - Two - + + Uniq + Uniq - - Four - + + MSC + MSC - - Six - + + Hardware Class + 硬件类别 - - Eight - + + Array Handle + 数组程序 - - Nine - + + Form Factor + 尺寸型号 - - Ten - + + Set + 设置 - - Twelve - 十二 + + Bank Locator + 内存通道 - - Fourteen - 十四 + + Part Number + 部件号码 - - Sixteen - 十六 + + Rank + 位列 - - Eighteen - 十八 + + Memory Technology + 内存技术 - - Twenty - 二十 + + Memory Operating Mode Capability + 内存操作模式 - - Twenty-two - 二十二 + + Module Manufacturer ID + 组件制造商 - - Twenty-four - 二十四 + + Module Product ID + 组件产品ID - - Twenty-six - 二十六 + + Memory Subsystem Controller Manufacturer ID + 内存子系统控制器制造商 - - Twenty-eight - 二十八 + + Memory Subsystem Controller Product ID + 内存子系统控制器产品ID - - Thirty - 三十 + + Non-Volatile Size + 不易丢失大小 - - Thirty-two - 三十二 + + Volatile Size + 易丢失大小 - - Thirty-four - 三十四 + + Cache Size + 缓存大小 - - Thirty-six - 三十六 + + Logical Size + 逻辑大小 - - Thirty-eight - 三十八 + + inch + 英寸 - - Forty - 四十 + + Date + 日期 - - Forty-two - 四十二 + + ioport + I/O端口 - - Forty-four - 四十四 + + network + 网络 - - Forty-six - 四十六 + + Width + - - Forty-eight - 四十八 + + battery + 电池 - - Fifty - 五十 + + native-path + 安装路径 - - Fifty-two - 五十二 + + power supply + 供电 - - Fifty-four - 五十四 + + updated + 更新时间 - - Fifty-six - 五十六 + + has history + 历史记录 - - Fifty-eight - 五十八 + + has statistics + 用电统计 - - Sixty - 六十 + + rechargeable + 可再充电 - - Sixty-two - 六十二 + + state + 状态 - - Sixty-four - 六十四 + + voltage + - - Sixty-six - 六十六 + + warning-level + 警告等级 - - Sixty-eight - 六十八 + + energy + 容量 - - Seventy - 七十 + + energy-empty + 最低容量 - - Seventy-two - 七十二 + + energy-full + 完全充满容量 - - Seventy-four - 七十四 + + energy-full-design + 设计容量 - - Seventy-six - 七十六 + + energy-rate + 能量密度 - - Seventy-eight - 七十八 + + percentage + 电量 - - Eighty - 八十 + + status + - - Eighty-two - 八十二 + + technology + 电池技术 - - Eighty-four - 八十四 + + icon-name + 图标 - - Eighty-six - 八十六 + + online + 在线 - - Eighty-eight - 八十八 + + daemon-version + Daemon版本 - - Ninety - 九十 + + on-battery + 使用电池 - - Ninety-two - 九十二 + + lid-is-closed + 笔记本合盖 - - Ninety-four - 九十四 + + lid-is-present + 打开笔记本盖子 - - Ninety-six - 九十六 + + critical-action + 电量极低时执行 - - Ninety-eight - 九十八 + + Alias + - - One hundred - 一百 + + Clock + - - One hundred and Two - 一百零二 + + copies + 复印数量 - - One hundred and four - 一百零四 + + description + - - One hundred and Six - 一百零六 + + Driver Activation Cmd + - - One hundred and Eight - 一百零八 + + Driver Modules + 驱动模块 - - One hundred and Ten - 一百一十 + + job-cancel-after + 此时取消打印任务 - - One hundred and Twelve - 一百一十二 + + job-hold-until + 保留打印任务直至 - - One hundred and Fourteen - 一百一十四 + + job-priority + 任务优先级 - - One hundred and Sixteen - 一百一十六 + + latency + - - One hundred and Eighteen - 一百一十八 + + marker-change-time + 标记修改次数 - - One hundred and Twenty - 一百二十 + + number-up + 编号 - - One hundred and Twenty-two - 一百二十二 + + orientation-requested + 打印方向 - - One hundred and Twenty-four - 一百二十四 + + physical id + - - One hundred and Twenty-six - 一百二十六 + + print-color-mode + 颜色模式 - - One hundred and Twenty-eight - 一百二十八 + + printer-is-accepting-jobs + 当前可打印 - - One hundred and Ninety-two - 一百九十二 + + printer-is-shared + 打印机已共享 - - Two hundred and fifty-six - 二百五十六 + + printer-is-temporary + 临时打印机 - - Device Name - 设备名称 - - - - - Vendor - 制造商 + + printer-make-and-model + 制造商和型号 - - Chip - 芯片 + + printer-state-change-time + 打印机状态修改时间 - - - Physical ID - 物理ID + + printer-state-reasons + 打印机状态信息 - - SysFS_Path - + + printer-type + 打印机类型 - - Revision - + + printer-uri-supported + 支持的URI - - KernelModeDriver - + + Product Date + 产品日子 - - IRQ - 中断 + + sides + 打印面数 - - Disable - 禁用 + SSD + 固态 - - Version - 版本 + HDD + 机械 - - Chipset - 芯片组 - - - - Module Alias - 模块别名 - - - - Speed - 速度 + + logicalsectorsize + 逻辑分区大小 - - Maximum Power - 最大功率 + + sectorsize + 扇区大小 - - Driver - 驱动 + + guid + 全局唯一标识符 - - Driver Version - 驱动版本 + + Geometry (Logical) + 几何数据(逻辑) + + + DeviceManager - - Capabilities - 功能 + + + + + + + + + + + Overview + 概况 - - logical name - 逻辑名称 + + + + CPU + 处理器 - - Logical Name - 逻辑名称 + + + CPU quantity + CPU数量 - - MAC Address - 物理地址 + + + Motherboard + 主板 - - CPU ID - 处理器ID + + + Memory + 内存 - - Core ID - 核心ID + + + Display Adapter + 显示适配器 - - Threads - 线程数 + + + Sound Adapter + 音频适配器 - - BogoMIPS - 运行速度(Bogomips) + + + Storage + 存储设备 - - Architecture - 架构 + + + Other PCI Devices + 其他PCI设备 - - CPU Family - 家族 + + + Battery + 电池 - - - Processor - 逻辑处理器 + + + Bluetooth + 蓝牙 - - Core(s) - + + + Network Adapter + 网络适配器 - - Virtualization - 虚拟化 + + + Mouse + 鼠标 - - Flags - 特性 + + + Keyboard + 键盘 - - Extensions - 扩展指令集 + + + Monitor + 显示设备 - - L3 Cache - L3缓存 + + + CD-ROM + 光驱 - - L4 Cache - L4缓存 + + + Printer + 打印机 - - L2 Cache - L2缓存 + + + Camera + 图像设备 - - L1i Cache - L1缓存(指令) + + + Other Devices + Other Input Devices + 其他设备 - - L1d Cache - L1缓存(数据) + + + + Device + 设备 + + + + + + OS + 操作系统 + + + + DeviceMonitor + + + + + + inch + 英寸 + + + + GetDriverNameWidget + + + + Select a driver for update + 选择需要更新的驱动程序 + + + + No drivers found in this folder + 所选文件夹未检测到驱动文件 + + + + GetInfoPool + + + Loading Audio Device Info... + 获取音频设备信息... + + + + Loading BIOS Info... + 获取BIOS信息... + + + + Loading CD-ROM Info... + 获取光驱信息... + + + + Loading Operating System Info... + 获取操作系统信息... + + + + Loading CPU Info... + 获取处理器信息... + + + + Loading Other Devices Info... + 获取其他设备信息... + + + + Loading Power Info... + 获取电池信息... + + + + Loading Printer Info... + 获取打印机信息... + + + + Loading Mouse Info... + 获取鼠标信息... + + + + Loading Network Adapter Info... + 获取网络适配器信息... + + + + LogTreeView + + + + + Disable + 禁用 + + + + Unavailable + 不可用 + + + + LogViewItemDelegate + + + Disable + 禁用 + + + + Unavailable + 不可用 + + + + MainWindow + + + Device Info + export file's name + 设备信息 + + + + Display shortcuts + 显示快捷键 + + + + Close + 关闭 + + + + Help + 帮助 + + + + Copy + 复制 + + + + System + 系统 + + + + Export + 导出 + + + + Refresh + 刷新 + + + + Device Manager + 设备管理器 + + + + Hardware + 硬件信息 + + + + Drivers + 驱动管理 + + + + Monitor + 显示设备 + + + + Overview + 概况 + + + + Display Adapter + 显示适配器 + + + + CPU + 处理器 + + + + Network Adapter + 网络适配器 + + + + Battery + 电池 + + + + PageDetail + + + More + 更多 + + + + PageDriverBackupInfo + + + + Name + 名称 + + + + + Current Version + 当前版本 + + + + + Driver Platform Version + 驱动平台版本 + + + + Status + 状态 + + + + Action + 操作 + + + + Backupable Drivers + 可备份驱动 + + + + Backed up Drivers + 已备份驱动 + + + + PageDriverControl + + + + Updating + 正在更新 + + + + + + Cancel + button + 取 消 + + + + Next + 下一步 + + + + Warning + 注意 + + + + The device will be unavailable after the driver uninstallation + 将从系统中卸载此驱动程序,卸载后该设备不可用 + + + + Uninstall + button + 卸 载 + + + + Uninstalling + 正在卸载 + + + + Update successful + 驱动更新成功 + + + + Uninstallation successful + 驱动卸载成功 + + + + Update failed + 驱动更新失败 + + + + Uninstallation failed + 驱动卸载失败 + + + + OK + button + 确 定 + + + + Next + button + 下一步 + + + + The selected folder does not exist, please select again + 所选文件夹不存在,请重新选择 + + + + Update + button + 更 新 + + + + Previous + button + 上一步 + + + + Broken package + 包文件损坏 + + + + Unmatched package architecture + 包文件与系统架构不匹配 + + + + + The selected file does not exist, please select again + 所选文件不存在,请重新选择 + + + + It is not a driver + 该文件不是驱动文件 + + + + Unable to install - no digital signature + 无法安装,安装包无数字签名 + + + + Unknown error + 未知错误 + + + + The driver module was not found + 未发现该驱动模块 + + + + Invalid module format + 模块格式无效 + + + + The driver module has dependencies + 驱动模块被依赖 + + + + PageDriverInstallInfo + + + + + Device Name + 设备名称 + + + + Version Available + 可安装版本 + + + + + Size + 大小 + + + + + Status + 状态 + + + + + Action + 操作 + + + + New Version + 可更新版本 + + + + Current Version + 当前版本 + + + + Missing drivers (%1) + 可安装驱动 (%1) + + + + Outdated drivers (%1) + 可更新驱动 (%1) + + + + Up-to-date drivers (%1) + 无需更新驱动 (%1) + + + + PageDriverManager + + + + + Driver Install + 驱动安装 + + + + + + + Driver Backup + 驱动备份 + + + + + Driver Restore + 驱动还原 + + + + OK + 确 定 + + + + Feedback + 反馈 + + + + PageDriverRestoreInfo + + + You do not have any drivers to restore, please backup first + 您没有驱动可以还原,请先备份 + + + + Go to Backup Driver + 前往备份驱动 + + + + Name + 名称 + + + + Current Version + 当前版本 - - Stepping - 步进 + + Backup Version + 备份版本 - - Frequency - 频率 + + Action + 操作 - - - - Max Frequency - 最大频率 + + Restorable Drivers + 可还原驱动 + + + PageListView - - Graphics Memory - 显存 + + Refresh + 刷新 - - Memory Address - 内存地址 + + Export + 导出 - - IO Port - I/O端口 + + Overview + 概况 - - Maximum Resolution - 最大分辨率 + + Driver Install + 驱动安装 - - Minimum Resolution - 最小分辨率 + + Driver Backup + 驱动备份 - - Description - 描述 + + Driver Restore + 驱动还原 + + + PageMultiInfo - - DP - DP + + + + Storage + 存储设备 - - eDP - eDP + + + + Memory + 内存 - - HDMI - HDMI + + Failed to enable the device + 启用失败 - - VGA - VGA + + Failed to disable the device + 禁用失败 - - DVI - DVI + + Failed to disable it: unable to get the device SN + 无法获取设备序列号,禁用失败 - - DigitalOutput - DigitalOutput + + Update Drivers + 更新驱动 - - Display Output - 显示输出 - - - - Interface - 接口 + + Uninstall Drivers + 卸载驱动 + + + PageOverview - - Bus Info - 总线信息 + + Refresh + 刷新 - - bus info - 总线信息 - + + Export + 导出 + - - Maximum Current - 最大电流 + + Copy + 复制 - - Unavailable - 不可用 + + Overview + 概况 + + + PageSingleInfo - - Type - 类型 + + Refresh + 刷新 - - Total Width - 总位宽 + + Export + 导出 - - Locator - 插槽 + + Copy + 复制 - - Configured Voltage - 配置电压 + + + Enable + 启用 - - Maximum Voltage - 最高电压 + + Update drivers + 更新驱动 - - Minimum Voltage - 最低电压 + + Uninstall drivers + 卸载驱动 - - Configured Speed - 配置速度 + + Allow it to wake the computer + 允许唤起电脑 - - Data Width - 数据位宽 + + Disable + 禁用 - - - Display Input - 显示输入 + + + + Failed to disable it: unable to get the device SN + 无法获取设备序列号,禁用失败 - - Interface Type - 接口类型 + + Failed to disable the device + 禁用失败 - - Support Resolution - 支持分辨率 + + Failed to enable the device + 启用失败 - - Current Resolution - 当前分辨率 + + Update Drivers + 更新驱动 - - Refresh Rate - 刷新率 - + + Uninstall Drivers + 卸载驱动 + + + + QObject - - Display Ratio - 显示比例 + + + + + CPU + 处理器 - - Primary Monitor - 主显示器 + + + + + No CPU found + 未发现处理器 - - Size - 大小 + + + + + Motherboard + 主板 - - Maximum Rate - 最大速率 + + + + + No motherboard found + 未发现主板 - - Negotiation Rate - 协商速率 + + + + + No memory found + 未发现内存 - - Port - 端口 + + + + + Memory + 内存 - - Multicast - 组播 + + + + + Storage + 存储设备 - - Link - 连接 + + + + + No disk found + 未发现磁盘 - - Latency - 延迟 + + Driver restore failed! + 驱动还原失败! - - IP - IP + + + Please try again or give us feedback + 请重试,或反馈给我们 - - Firmware - 固件 + + Driver backup failed! + 驱动备份失败! - - Duplex - 双工 + + + + + + Display Adapter + 显示适配器 - - Broadcast - 广播 + + + + + No GPU found + 未发现GPU - - Auto Negotiation - 自动协商 + + + + + Monitor + 显示设备 - - Input/Output - 输入/输出 + + + + + No monitor found + 未发现显示设备 - - Memory - 内存 + + + + + + Network Adapter + 网络适配器 - - - Model - 型号 + + + + + + No network adapter found + 未发现网络适配器 - - - Status - 状态 + + + + + + + Sound Adapter + 音频适配器 - - Capacity - 最大容量 + + + + + No audio device found + 未发现音频设备 - - Voltage - 电压 + + + + + + Bluetooth + 蓝牙 - - Slot - 插槽 + + + + + No Bluetooth device found + 未发现蓝牙设备 - - Design Capacity - 设计容量 + + + + + Other PCI Devices + 其他PCI设备 - - Design Voltage - 设计电压 + + + + + No other PCI devices found + 未发现其他PCI设备 - - SBDS Version - SBDS版本 + + + + + Power + 电池 - - SBDS Serial Number - SBDS序列号 + + + + + No battery found + 未发现电池 - - SBDS Manufacture Date - SBDS制造日期 + + + + + + Keyboard + 键盘 - - SBDS Chemistry - SBDS材料 + + + + + No keyboard found + 未发现键盘 - - Temperature - 温度 + + + + + + Mouse + 鼠标 - - Name - 名称 - - - - Shared - 已共享 + + + + + No mouse found + 未发现鼠标 - - URI - URI + + + + + + Printer + 打印机 - - Media Type - 介质类型 + + + + + No printer found + 未发现打印机 - - Firmware Version - 固件版本 + + + + + Camera + 图像设备 - - Serial Number - 序列号 + + + + + No camera found + 未发现图像设备 - - Rotation Rate - 转速 + + + + + CD-ROM + 光驱 - - SubVendor - 子制造商 + + + + + No CD-ROM found + 未发现光驱 - - SubDevice - 子设备 + + + + + + + Other Devices + 其他设备 - - Driver Status - 驱动状态 + + + + + No other devices found + 未发现其他设备 - - Config Status - 配置状态 + + + Device Manager + 设备管理器 - - Phys - Phys + + Device Manager is a handy tool for viewing hardware information and managing the devices. + 设备管理器是查看、管理硬件设备的工具软件。 - - Sysfs - Sysfs + + New drivers available! Install or update them now. + 您有驱动可进行安装/更新 - - Handlers - 处理程序 + + View + 查看 - - PROP - PROP + + Include subfolders + 包括子文件夹 - - EV - EV + + Search for drivers in this path + 选择驱动所在位置 - - KEY - KEY + + %1 driver updates available + 发现%1个驱动可安装更新 - - Bus - 总线 + + + Time checked: %1 + 检测时间: %1 - - BIOS Information - BIOS信息 + + Downloading drivers for %1... + 正在下载%1驱动… - - Base Board Information - 主板信息 + + Download speed: %1 Downloaded %2/%3 + 下载速度:%1 已完成 %2/%3 - - System Information - 系统信息 + + Installing drivers for %1... + 正在安装%1驱动… - - Chassis Information - 机箱信息 + + %1 drivers installed, %2 drivers failed + 驱动安装成功%1个,失败%2个 - - Physical Memory Array - 内存插槽信息 + + %1 drivers installed + 共成功安装%1个驱动 - - Release Date - 发布日期 + + Failed to install drivers + 驱动安装失败 - - Address - 地址 + + Network error. Reconnecting... + 网络异常,重试中 - - Runtime Size - 运行内存大小 + + Download speed: %1 + 下载速度:%1 - - ROM Size - ROM大小 + + Your drivers are up to date + 驱动已是最新 - - Characteristics - 特性 + + All drivers have been backed up + 驱动已全部备份 - - BIOS Revision - BIOS修订版本 + + + A total of %1 drivers, of which %2 have been backed up + 总计%1个驱动,其中%2个已备份 - - Firmware Revision - 固件修订版本 + + You have %1 drivers that can be backed up, it is recommended to do so immediately + 您有%1个驱动可以备份,建议立即备份 - - Product Name - 产品名称 + + You have %1 drivers that can be backed up + 您有%1个驱动可以备份 - - Asset Tag - 资产编号 + + Backing up the %1 driver, a total of %2 drivers + 正在备份第%1个驱动,共%2个 - - Features - 特征 + + Backing up: %1 + 正在备份:%1 - - Location In Chassis - 机箱内位置 + + %1 drivers backed up, %2 drivers failed + 驱动备份成功%1个,失败%2个 - - Chassis Handle - 机箱程序 + + Failed to backup drivers + 备份失败 - - Contained Object Handles - 包含对象程序 + + %1 drivers backed up + %1个驱动已备份 - - UUID - UUID + + You have %1 drivers that can be restored + 您有%1个驱动可以还原 - - Wake-up Type - 唤醒类型 + + Please select a driver to restore + 请选择驱动还原 - - SKU Number - SKU号 + + Driver is restoring... + 驱动还原中… - - Family - 家族 + + Restoring: %1 + 正在还原:%1 - - Lock - + + reboot + 重启电脑 - - Boot-up State - 开机状态 + + Please %1 for the installed drivers to take effect + 驱动已安装完成,请稍后%1生效 - - Power Supply State - 供电状态 + + View backup path + 查看备份路径 - - Thermal State - 散热状态 + + Backup All + 一键备份 - - Security Status - 安全状态 + + + submit feedback + 反馈 - - OEM Information - OEM信息 + + Please try again or %1 to us + 驱动未安装成功,请重试或%1给我们 - - Height - 高度 + + Install All + 一键安装 - - Number Of Power Cords - 电源线数 + + + Scan Again + 重新检测 - - Contained Elements - 包含组件数 + + Cancel + 取 消 - - Location - 位置 + + Scanning hardware device drivers, please wait... + 正在进行硬件驱动扫描,请耐心等待... - - Error Correction Type - 纠错类型 + + + Scanning %1 + 正在扫描%1 - - Maximum Capacity - 最大容量 + + Scan failed + 检测失败 - - Error Information Handle - 错误信息程序 + + Network unavailable + 无网络 - - Number Of Devices - 卡槽数量 + + Please check your network connection + 请检查网络连接 - - BIOS ROMSIZE - BIOS ROM大小 + + Please scan again or %1 to us + 请重新检测或%1给我们 - - Release date - 发布日期 + + You are installing a driver, which will be interrupted if you exit. + 当前正在安装驱动,退出应用后任务将会中断 - - Board name - 主板名称 + + + + Are you sure you want to exit? + 确认是否退出应用? - - SMBIOS Version - SMBIOS版本 + + + + Exit + button + 退 出 - - Language Description Format - 语言描述格式 + + + + Cancel + button + 取 消 - - Installable Languages - 可安装语言数 + + You are backing up drivers, which will be interrupted if you exit. + 当前正在备份驱动,退出应用后任务将会中断 - - Currently Installed Language - 当前安装语言 + + You are restoring drivers, which will be interrupted if you exit. + 当前正在还原驱动,退出应用后任务将会中断 - - BD Address - 蓝牙设备地址 + + Bluetooth adapter + 蓝牙适配器 - - ACL MTU - ACL MTU + + + Imaging device + 图像设备 - - SCO MTU - SCO MTU + + Display adapter + 显卡 - - Packet type - 数据包类型 + + Sound card + 声卡 - - Link policy - 连接策略 + + Network adapter + 网卡 - - Link mode - 连接模式 + + Wireless network adapter + 无线网卡 - - Class - 类别 + + Installation successful + 安装成功 - - Service Classes - 服务类别 + + Installation failed + 安装失败 - - Device Class - 设备类别 + + Downloading + 下载中 - - HCI Version - HCI版本 + + Installing + 安装中 - - LMP Version - LMP版本 + + Not installed + 驱动未安装 - - Subversion - 子版本 + + Out-of-date + 驱动可更新 - - Device - 设备 + + Waiting + 等待中 - - Serial ID - 序列号 + + Not backed up + 驱动未备份 - - product - 产品 - - - - Powered - 供电 + + Backing up + 正在备份 - - Discoverable - 可发现 + + Backup failed + 备份失败 - - Pairable - 可配对 + + Backup successful + 备份成功 - - Modalias - 设置命令别名 + + Restoring + 还原中 - - Discovering - 搜索中 + + Unknown error + 未知错误 - - Device File - 设备文件 + + Network error + 网络异常 - - Device Files - 设备文件 + + Canceled + 已取消 - - Device Number - 设备编号 + + Failed to get driver files + 驱动文件获取异常 - - Application - 应用 + + Update + 更新 - - - ansiversion - ANSI版本 + + + Backup + 备份 - - CPU implementer - CPU程序 + + Restore + 还原 - - CPU architecture - CPU架构 + + Install + 安装 - - CPU variant - CPU变量 + + + inch + 英寸 + + + TableWidget - - CPU part - CPU部件 + + + Disable + 禁用 - - CPU revision - CPU版本 + + Refresh + 刷新 - - GDDR capacity - GDDR容量 + + Export + 导出 - - GPU vendor - GPU供应商 + + Update drivers + 更新驱动 - - GPU type - GPU类型 + + Uninstall drivers + 卸载驱动 - - EGL version - EGL版本 + + Allow it to wake the computer + 允许唤起电脑 - - EGL client APIs - EGL接口 + + + Enable + 启用 + + + TextBrowser - - GL version - GL版本 + + Refresh + 刷新 - - GLSL version - GLSL版本 + + Export + 导出 - - - - Unknown - 未知 + + Copy + 复制 - - Uniq - Uniq + + Disable + 禁用 - - MSC - MSC + + Unavailable + 不可用 + + + UrlChooserEdit - - - - Hardware Class - 硬件类别 + + Select a local folder please + 请选择本地文件夹 + + + WaitingWidget - - Array Handle - 数组程序 - - - - Form Factor - 尺寸型号 - - - - Set - 设置 - - - - Bank Locator - 内存通道 - - - - Part Number - 部件号码 - - - - Rank - 位列 - - - - Memory Technology - 内存技术 - - - - Memory Operating Mode Capability - 内存操作模式 - - - - Module Manufacturer ID - 组件制造商 - - - - Module Product ID - 组件产品ID - - - - Memory Subsystem Controller Manufacturer ID - 内存子系统控制器制造商 - - - - Memory Subsystem Controller Product ID - 内存子系统控制器产品ID - - - - Non-Volatile Size - 不易丢失大小 - - - - Volatile Size - 易丢失大小 - - - - Cache Size - 缓存大小 - - - - Logical Size - 逻辑大小 - - - - - inch - 英寸 - - - - Date - 日期 - - - - ioport - I/O端口 - - - - network - 网络 - - - - battery - 电池 - - - - native-path - 安装路径 - - - - power supply - 供电 - - - - updated - 更新时间 - - - - has history - 历史记录 - - - - has statistics - 用电统计 - - - - rechargeable - 可再充电 - - - - state - 状态 - - - - warning-level - 警告等级 - - - - energy - 容量 - - - - energy-empty - 最低容量 - - - - energy-full - 完全充满容量 - - - - energy-full-design - 设计容量 - - - - energy-rate - 能量密度 - - - - percentage - 电量 - - - - technology - 电池技术 - - - - icon-name - 图标 - - - - online - 在线 - - - - daemon-version - Daemon版本 - - - - on-battery - 使用电池 - - - - lid-is-closed - 笔记本合盖 - - - - lid-is-present - 打开笔记本盖子 - - - - critical-action - 电量极低时执行 - - - - copies - 复印数量 - - - - job-cancel-after - 此时取消打印任务 - - - - job-hold-until - 保留打印任务直至 - - - - job-priority - 任务优先级 - - - - marker-change-time - 标记修改次数 - - - - number-up - 编号 - - - - orientation-requested - 打印方向 - - - - print-color-mode - 颜色模式 - - - - printer-is-accepting-jobs - 当前可打印 - - - - printer-is-shared - 打印机已共享 - - - - printer-is-temporary - 临时打印机 - - - - printer-make-and-model - 制造商和型号 - - - - printer-state-change-time - 打印机状态修改时间 - - - - printer-state-reasons - 打印机状态信息 - - - - printer-type - 打印机类型 - - - - printer-uri-supported - 支持的URI - - - - sides - 打印面数 - - - - SSD - 固态 - - - - HDD - 机械 - - - - logicalsectorsize - 逻辑分区大小 - - - - sectorsize - 扇区大小 - - - - guid - 全局唯一标识符 - - - - Geometry (Logical) - 几何数据(逻辑) - + + Loading... + 正在载入... + From 02ee8d0d691b151d6c1d0424a825d26bbe67477c Mon Sep 17 00:00:00 2001 From: zhanghongyuan Date: Tue, 17 Dec 2024 16:51:37 +0800 Subject: [PATCH 12/69] fix: the w525 device of monitor display fix the w525 device of monitor display Log: fix the w525 device of monitor display Task: https://pms.uniontech.com/task-view-368603.html --- .../src/DeviceManager/DeviceMonitor.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp b/deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp index f40512508..10c11f466 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp @@ -327,12 +327,19 @@ bool DeviceMonitor::setMainInfoFromXrandr(const QString &info, const QString &ra QRegExp rateStart("[a-zA-Z]"); int pos = curRate.indexOf(rateStart); if (pos > 0 && curRate.size() > pos && !Common::boardVendorType().isEmpty()) { - curRate = QString::number(ceil(curRate.left(pos).toDouble())) + curRate.right(curRate.size() - pos); + if (Common::specialComType == 1) { + curRate = QString::number(ceil(curRate.left(pos).toDouble())) + ".00" + curRate.right(curRate.size() - pos); + } else { + curRate = QString::number(ceil(curRate.left(pos).toDouble())) + curRate.right(curRate.size() - pos); + } + } + if (Common::specialComType == 1) { + m_RefreshRate = QString("%1").arg(curRate); } if (Common::specialComType == 5) { m_CurrentResolution = QString("%1").arg(reScreenSize.cap(1)); } else { - m_CurrentResolution = QString("%1@%2").arg(reScreenSize.cap(1)).arg(curRate); + m_CurrentResolution = QString("%1 @%2").arg(reScreenSize.cap(1)).arg(curRate); } } else m_CurrentResolution = QString("%1").arg(reScreenSize.cap(1)); From db15a61f9d748cc78277999e14784a013f593e08 Mon Sep 17 00:00:00 2001 From: zhanghongyuan Date: Wed, 18 Dec 2024 15:21:04 +0800 Subject: [PATCH 13/69] fix: fix the UFS display fix the UFS display Log: fix the UFS display Bug: https://pms.uniontech.com/bug-view-276131.html Change-Id: I41512e4466ff5b0dc4196b4c444ad5488c44a2b2 --- deepin-devicemanager/src/GenerateDevice/HWGenerator.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/deepin-devicemanager/src/GenerateDevice/HWGenerator.cpp b/deepin-devicemanager/src/GenerateDevice/HWGenerator.cpp index 17c221b51..55e2cca21 100644 --- a/deepin-devicemanager/src/GenerateDevice/HWGenerator.cpp +++ b/deepin-devicemanager/src/GenerateDevice/HWGenerator.cpp @@ -280,8 +280,6 @@ void HWGenerator::generatorDiskDevice() tempMap["Name"] = "nouse"; // 应HW的要求,将描述固定为 Universal Flash Storage tempMap["Description"] = "Universal Flash Storage"; - // 应H的要求,添加interface UFS 3.1 - tempMap["Interface"] = "UFS 3.1"; // 读取interface版本 QProcess process; From 7602f7eedf549579cdc73fb199ea504e7398241b Mon Sep 17 00:00:00 2001 From: Wang Yu Date: Fri, 20 Dec 2024 14:39:52 +0800 Subject: [PATCH 14/69] fix: remove invalid url remove invalid url Log: remove invalid url --- .../deepin-devicecontrol/src/drivercontrol/drivermanager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deepin-devicemanager-server/deepin-devicecontrol/src/drivercontrol/drivermanager.cpp b/deepin-devicemanager-server/deepin-devicecontrol/src/drivercontrol/drivermanager.cpp index 10034d7c6..d4106e589 100644 --- a/deepin-devicemanager-server/deepin-devicecontrol/src/drivercontrol/drivermanager.cpp +++ b/deepin-devicemanager-server/deepin-devicecontrol/src/drivercontrol/drivermanager.cpp @@ -237,7 +237,7 @@ bool DriverManager::installDriver(const QString &filepath) //模块已被加载 /* * 下面代码由 liujun 于 2021年11月9号 注释 - * 为修复bug https://pms.uniontech.com/zentao/bug-view-101808.html + * 为修复bug 101808 */ // if (mp_modcore->modIsLoaded(filepath)) { // sigProgressDetail(10, QString("could not insert module %1 :file exist").arg(filepath)); From 48205819315549fc675db383ff1e5ccc00b2c2ea Mon Sep 17 00:00:00 2001 From: zhanghongyuan Date: Fri, 20 Dec 2024 17:14:25 +0800 Subject: [PATCH 15/69] fix: the camera info show incorrect fix the camera info show incorrect Log: fix the camera info show incorrect Bug: https://pms.uniontech.com/bug-view-290539.html Change-Id: Ibea8fb2ff9150674c7257fdc6ab9ca1159d77ff2 --- deepin-devicemanager/src/DeviceManager/DeviceImage.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/deepin-devicemanager/src/DeviceManager/DeviceImage.cpp b/deepin-devicemanager/src/DeviceManager/DeviceImage.cpp index 871a26947..53f3608a0 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceImage.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceImage.cpp @@ -18,6 +18,7 @@ DeviceImage::DeviceImage() { m_CanEnable = true; m_CanUninstall = true; + m_forcedDisplay = true; } void DeviceImage::setInfoFromLshw(const QMap &mapInfo) From 366a729dba17555fd4f84569781bf37c65a8509c Mon Sep 17 00:00:00 2001 From: zhanghongyuan Date: Mon, 23 Dec 2024 09:20:50 +0800 Subject: [PATCH 16/69] fix: the bluetooth of false identification fix the bluetooth of false identification Log: fix the bluetooth of false identification Task: https://pms.uniontech.com/task-view-360593.html Change-Id: I56de4352eed27414aba935daa97cd72ef76dd309 --- deepin-devicemanager/src/GenerateDevice/DeviceGenerator.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deepin-devicemanager/src/GenerateDevice/DeviceGenerator.cpp b/deepin-devicemanager/src/GenerateDevice/DeviceGenerator.cpp index 8488410cf..23e445b59 100644 --- a/deepin-devicemanager/src/GenerateDevice/DeviceGenerator.cpp +++ b/deepin-devicemanager/src/GenerateDevice/DeviceGenerator.cpp @@ -850,7 +850,7 @@ void DeviceGenerator::getBlueToothInfoFromHwinfo() if ((*it)["Hardware Class"] == "hub" || (*it)["Hardware Class"] == "mouse" || (*it)["Hardware Class"] == "keyboard") continue; - if ((*it)["Model"].contains("bluetooth", Qt::CaseInsensitive) || (*it)["Hardware Class"] == "bluetooth" || (*it)["Driver"] == "btusb" || (*it)["Device"] == "BCM20702A0") { + if ((*it)["Model"].contains("bluetooth", Qt::CaseInsensitive) || (*it)["Hardware Class"] == "bluetooth" || (*it)["Driver"] == "btusb" || (*it)["Device"] == "BCM20702A0" || (*it)["Device"] == "SCM2625 BT 5.2 network adapter") { // 判断重复设备数据 QString unique_id = uniqueID(*it); From 02f7a69a22db50ed04943ef3b5fd600ee35f1e83 Mon Sep 17 00:00:00 2001 From: zhanghongyuan Date: Mon, 30 Dec 2024 17:49:58 +0800 Subject: [PATCH 17/69] fix: the device of monitor display fix the device of monitor display Log: fix the device of monitor display Bug: https://pms.uniontech.com/bug-view-296425.html https: //pms.uniontech.com/bug-view-296689.html Change-Id: Ief79bbd158fef4f7a2b9332ec87e82246cd55a87 --- .../src/DeviceManager/DeviceMonitor.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp b/deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp index 10c11f466..25468f4ee 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp @@ -249,6 +249,11 @@ const QString DeviceMonitor::getOverviewInfo() QString ov; ov = QString("%1(%2)").arg(m_Name).arg(m_ScreenSize); + if (Common::specialComType == 6) { + ov = QString("(%1)").arg(m_ScreenSize); + } else { + ov = QString("%1(%2)").arg(m_Name).arg(m_ScreenSize); + } return ov; } @@ -261,7 +266,8 @@ void DeviceMonitor::initFilterKey() void DeviceMonitor::loadBaseDeviceInfo() { // 添加基本信息 - addBaseDeviceInfo(("Name"), m_Name); + if (Common::specialComType != 6) + addBaseDeviceInfo(("Name"), m_Name); addBaseDeviceInfo(("Vendor"), m_Vendor); addBaseDeviceInfo(("Type"), m_Model); addBaseDeviceInfo(("Display Input"), m_DisplayInput); @@ -333,10 +339,10 @@ bool DeviceMonitor::setMainInfoFromXrandr(const QString &info, const QString &ra curRate = QString::number(ceil(curRate.left(pos).toDouble())) + curRate.right(curRate.size() - pos); } } - if (Common::specialComType == 1) { + if (Common::specialComType == 1 || Common::specialComType == 6) { m_RefreshRate = QString("%1").arg(curRate); } - if (Common::specialComType == 5) { + if (Common::specialComType == 5 || Common::specialComType == 6) { m_CurrentResolution = QString("%1").arg(reScreenSize.cap(1)); } else { m_CurrentResolution = QString("%1 @%2").arg(reScreenSize.cap(1)).arg(curRate); From 49ecd82ddf2dcc79c9e748d89603d6375fb38d83 Mon Sep 17 00:00:00 2001 From: zhanghongyuan Date: Mon, 6 Jan 2025 14:50:29 +0800 Subject: [PATCH 18/69] fix: the monitor fresh rate fix the monitor fresh rate Log: fix the monitor fresh rate Bug: https://pms.uniontech.com/bug-view-297753.html Change-Id: Ic01072becc0a0964ad08c4ce61c2f291f8890290 --- deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp b/deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp index 25468f4ee..e211e004a 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp @@ -339,7 +339,7 @@ bool DeviceMonitor::setMainInfoFromXrandr(const QString &info, const QString &ra curRate = QString::number(ceil(curRate.left(pos).toDouble())) + curRate.right(curRate.size() - pos); } } - if (Common::specialComType == 1 || Common::specialComType == 6) { + if (Common::specialComType == 1 || Common::specialComType == 5 || Common::specialComType == 6) { m_RefreshRate = QString("%1").arg(curRate); } if (Common::specialComType == 5 || Common::specialComType == 6) { From 322584861575ed8afc750c0d6b050d2ad60837fb Mon Sep 17 00:00:00 2001 From: zhanghongyuan Date: Mon, 6 Jan 2025 20:27:52 +0800 Subject: [PATCH 19/69] fix: the monitor paramer fix the monitor paramer Log: fix the monitor paramer Bug: https://pms.uniontech.com/bug-view-297753.html Change-Id: I385b24b29d099924cef6e21548e17ccbba9fa98e --- deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp b/deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp index e211e004a..6834749a9 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp @@ -269,7 +269,8 @@ void DeviceMonitor::loadBaseDeviceInfo() if (Common::specialComType != 6) addBaseDeviceInfo(("Name"), m_Name); addBaseDeviceInfo(("Vendor"), m_Vendor); - addBaseDeviceInfo(("Type"), m_Model); + if (Common::specialComType != 6) + addBaseDeviceInfo(("Type"), m_Model); addBaseDeviceInfo(("Display Input"), m_DisplayInput); addBaseDeviceInfo(("Interface Type"), m_Interface); } From 4cce766e6c9731c5fb5f9086612d51dbaeced8c3 Mon Sep 17 00:00:00 2001 From: zhanghongyuan Date: Tue, 7 Jan 2025 13:50:25 +0800 Subject: [PATCH 20/69] fix: the storage siez display fix the storage display Log: fix the storage display Bug: https://pms.uniontech.com/bug-view-297753.html Change-Id: I0dc129b531e3cb27a0828ff1847d08227646cab9 --- deepin-devicemanager/src/DeviceManager/DeviceStorage.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/deepin-devicemanager/src/DeviceManager/DeviceStorage.cpp b/deepin-devicemanager/src/DeviceManager/DeviceStorage.cpp index ab742a414..05930fa90 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceStorage.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceStorage.cpp @@ -133,7 +133,9 @@ bool DeviceStorage::setHwinfoInfo(const QMap &mapInfo) if (mapInfo.find("SysFS BusID") == mapInfo.end()) return false; - setAttribute(mapInfo, "Model", m_Name); + if (Common::specialComType <= 0) { + setAttribute(mapInfo, "Model", m_Name); + } setAttribute(mapInfo, "Vendor", m_Vendor); // 希捷硬盘为ATA硬盘,无法直接获取厂商信息,只能特殊处理 @@ -439,7 +441,7 @@ void DeviceStorage::appendDisk(DeviceStorage *device) void DeviceStorage::checkDiskSize() { - if (Common::specialVendorType() != Common::specialHString()) { + if (Common::specialComType <= 0) { return; //定制机型专用,其它慎用 } From 8702ea6c4103361500f836f2719df0d292b852b8 Mon Sep 17 00:00:00 2001 From: zhanghongyuan Date: Thu, 9 Jan 2025 15:42:59 +0800 Subject: [PATCH 21/69] fix: the monitor get info from xrander fix the monitor get info from xrander Log: fix the monitor get info from xrander Bug: https://pms.uniontech.com/bug-view-285297.html Change-Id: Ib43660c92187ec824d5a832194dbc609e3ee0d52 --- deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp | 2 +- deepin-devicemanager/src/Tool/ThreadExecXrandr.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp b/deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp index 6834749a9..b00d81f5e 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp @@ -440,6 +440,6 @@ bool DeviceMonitor::caculateScreenSize(const QString &edid) return true; double inch = std::sqrt(height * height + width * width) / 2.54 / 10; - m_ScreenSize = QString("%1 %2(%3mm X %4mm)").arg(QString::number(inch, '0', 1)).arg(("inch")).arg(width).arg(height); + m_ScreenSize = QString("%1 %2(%3mm X %4mm)").arg(QString::number(inch, '0', 1)).arg(translateStr("inch")).arg(width).arg(height); return true; } diff --git a/deepin-devicemanager/src/Tool/ThreadExecXrandr.cpp b/deepin-devicemanager/src/Tool/ThreadExecXrandr.cpp index be53c4f8f..a952e0b47 100644 --- a/deepin-devicemanager/src/Tool/ThreadExecXrandr.cpp +++ b/deepin-devicemanager/src/Tool/ThreadExecXrandr.cpp @@ -231,7 +231,7 @@ void ThreadExecXrandr::getMonitorInfoFromXrandrVerbose() { QList> lstMap; loadXrandrVerboseInfo(lstMap, "xrandr --verbose"); - + std::reverse(lstMap.begin(), lstMap.end()); QList >::const_iterator it = lstMap.begin(); for (; it != lstMap.end(); ++it) { if ((*it).size() < 1) From a9acd8676c3677f74846fca5270981b79b99491f Mon Sep 17 00:00:00 2001 From: zhanghongyuan Date: Mon, 13 Jan 2025 13:29:27 +0800 Subject: [PATCH 22/69] fix: adjust the select usb timeout adjust the select usb timeout, change the timeout 0.01s to 1s. Log: adjust the select usb timeout, change the timeout 0.01s to 1s. Task: https://pms.uniontech.com/task-view-371601.html Change-Id: Ie2922388a8b7fc4e23db94123d3d6ff6be364640 --- .../deepin-deviceinfo/src/hotplug/monitorusb.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deepin-devicemanager-server/deepin-deviceinfo/src/hotplug/monitorusb.cpp b/deepin-devicemanager-server/deepin-deviceinfo/src/hotplug/monitorusb.cpp index fa088b4ce..a5d7315ae 100644 --- a/deepin-devicemanager-server/deepin-deviceinfo/src/hotplug/monitorusb.cpp +++ b/deepin-devicemanager-server/deepin-deviceinfo/src/hotplug/monitorusb.cpp @@ -48,7 +48,7 @@ void MonitorUsb::monitor() FD_ZERO(&fds); FD_SET(fd, &fds); tv.tv_sec = 0; - tv.tv_usec = 10000; + tv.tv_usec = 1000000; int ret = select(fd + 1, &fds, nullptr, nullptr, &tv); // 判断是否有事件产生 From a7454bd2866a1aa38989b1a8a55f7c61f4ade608 Mon Sep 17 00:00:00 2001 From: zhanghongyuan Date: Tue, 14 Jan 2025 10:33:28 +0800 Subject: [PATCH 23/69] fix: fit the UFS for klv fit the UFS for klv Log: fit the UFS for klv Change-Id: I435e4f59b113164fe5a6138c869c85384e1cf5f2 --- deepin-devicemanager/src/GenerateDevice/HWGenerator.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/deepin-devicemanager/src/GenerateDevice/HWGenerator.cpp b/deepin-devicemanager/src/GenerateDevice/HWGenerator.cpp index 55e2cca21..597983182 100644 --- a/deepin-devicemanager/src/GenerateDevice/HWGenerator.cpp +++ b/deepin-devicemanager/src/GenerateDevice/HWGenerator.cpp @@ -280,6 +280,9 @@ void HWGenerator::generatorDiskDevice() tempMap["Name"] = "nouse"; // 应HW的要求,将描述固定为 Universal Flash Storage tempMap["Description"] = "Universal Flash Storage"; + if (Common::specialComType == 2) { + tempMap["Interface"] = "UFS 3.1"; + } // 读取interface版本 QProcess process; From 3c7ae8d1174c17ea70fd3b5f3ae04fb1779c8fbd Mon Sep 17 00:00:00 2001 From: gongheng Date: Mon, 20 Jan 2025 15:45:42 +0800 Subject: [PATCH 24/69] Revert "fix: adjust the select usb timeout" This reverts commit a9acd8676c3677f74846fca5270981b79b99491f. --- .../deepin-deviceinfo/src/hotplug/monitorusb.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deepin-devicemanager-server/deepin-deviceinfo/src/hotplug/monitorusb.cpp b/deepin-devicemanager-server/deepin-deviceinfo/src/hotplug/monitorusb.cpp index a5d7315ae..fa088b4ce 100644 --- a/deepin-devicemanager-server/deepin-deviceinfo/src/hotplug/monitorusb.cpp +++ b/deepin-devicemanager-server/deepin-deviceinfo/src/hotplug/monitorusb.cpp @@ -48,7 +48,7 @@ void MonitorUsb::monitor() FD_ZERO(&fds); FD_SET(fd, &fds); tv.tv_sec = 0; - tv.tv_usec = 1000000; + tv.tv_usec = 10000; int ret = select(fd + 1, &fds, nullptr, nullptr, &tv); // 判断是否有事件产生 From 7933df4d292a71371387e41b8b7f6bdc6d8d0eab Mon Sep 17 00:00:00 2001 From: Gong Heng Date: Mon, 20 Jan 2025 18:01:23 +0800 Subject: [PATCH 25/69] fix: adjust the select usb timeout adjust the select usb timeout, change the timeout 0.01s to 1s. Log: adjust the select usb timeout, change the timeout 0.01s to 1s. Bug: https://pms.uniontech.com/bug-view-301245.html --- .../deepin-deviceinfo/src/hotplug/monitorusb.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/deepin-devicemanager-server/deepin-deviceinfo/src/hotplug/monitorusb.cpp b/deepin-devicemanager-server/deepin-deviceinfo/src/hotplug/monitorusb.cpp index fa088b4ce..9b3542f9f 100644 --- a/deepin-devicemanager-server/deepin-deviceinfo/src/hotplug/monitorusb.cpp +++ b/deepin-devicemanager-server/deepin-deviceinfo/src/hotplug/monitorusb.cpp @@ -47,8 +47,8 @@ void MonitorUsb::monitor() break; FD_ZERO(&fds); FD_SET(fd, &fds); - tv.tv_sec = 0; - tv.tv_usec = 10000; + tv.tv_sec = 1; + tv.tv_usec = 0; int ret = select(fd + 1, &fds, nullptr, nullptr, &tv); // 判断是否有事件产生 From 05b1de7c2b8a1804792ec1b3365e624a51f5d4c9 Mon Sep 17 00:00:00 2001 From: zhanghongyuan Date: Mon, 17 Feb 2025 19:06:08 +0800 Subject: [PATCH 26/69] feat: add the storage overview info add the storage overview info Log: add the storage overview info Task: https://pms.uniontech.com/task-view-372725.html Change-Id: I3e7833c548382653026bcf0a6dec75c88ef9e2d9 --- .../src/DeviceManager/DeviceStorage.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/deepin-devicemanager/src/DeviceManager/DeviceStorage.cpp b/deepin-devicemanager/src/DeviceManager/DeviceStorage.cpp index 05930fa90..94a3b1eab 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceStorage.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceStorage.cpp @@ -519,7 +519,21 @@ QString DeviceStorage::subTitle() const QString DeviceStorage::getOverviewInfo() { - return QString("%1 (%2)").arg(m_Name).arg(m_Size);; + QString overViewInfo = QString("%1 (%2)").arg(m_Name).arg(m_Size); + + // 见内网gerrit项目 os-config 中机型的 specialComType , 示例配置文件位置如下: + // os-config/hardware/机型/etc/dsg/configs/overrides/org.deepin.devicemanager/org.deepin.devicemanager/4000-org.deepin.devicemanager.override.json + if (Common::specialComType == 5){ + if (m_Interface.contains("UFS", Qt::CaseInsensitive)) { + overViewInfo = QString("%1 %2").arg(m_Size).arg("UFS"); + } else if (m_Interface.contains("USB", Qt::CaseInsensitive)) { + overViewInfo = QString("%1 %2").arg(m_Size).arg("USB"); + } else { + overViewInfo = QString("%1 %2").arg(m_Size).arg(m_MediaType); + } + } + + return overViewInfo; } void DeviceStorage::initFilterKey() From c6948df47072277ba9fcc14d05e246c7e9bd453c Mon Sep 17 00:00:00 2001 From: zhanghongyuan Date: Sat, 22 Feb 2025 10:56:58 +0800 Subject: [PATCH 27/69] feat: modify the storage size modify the storage size Log: modify the storage size Task: https://pms.uniontech.com/task-view-372725.html --- .../src/DeviceManager/DeviceStorage.cpp | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/deepin-devicemanager/src/DeviceManager/DeviceStorage.cpp b/deepin-devicemanager/src/DeviceManager/DeviceStorage.cpp index 94a3b1eab..42a5c34c9 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceStorage.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceStorage.cpp @@ -446,17 +446,17 @@ void DeviceStorage::checkDiskSize() } quint64 gbyte = 1000000000; - if (m_Interface.contains("UFS", Qt::CaseInsensitive)) { - if (m_SizeBytes > 255*gbyte && m_SizeBytes < 257*gbyte) { - m_Size = "256 GB"; - } else if (m_SizeBytes > 511*gbyte && m_SizeBytes < 513*gbyte) { - m_Size = "512 GB"; - } else if (m_SizeBytes > 999*gbyte && m_SizeBytes < 1025*gbyte) { - m_Size = "1 TB"; - } else if (m_SizeBytes > 1999*gbyte && m_SizeBytes < 2049*gbyte) { - m_Size = "2 TB"; - } +// if (m_Interface.contains("UFS", Qt::CaseInsensitive)) { // TODO Ignore ufs disk + if (m_SizeBytes > 255*gbyte && m_SizeBytes < 257*gbyte) { + m_Size = "256 GB"; + } else if (m_SizeBytes > 511*gbyte && m_SizeBytes < 513*gbyte) { + m_Size = "512 GB"; + } else if (m_SizeBytes > 999*gbyte && m_SizeBytes < 1025*gbyte) { + m_Size = "1 TB"; + } else if (m_SizeBytes > 1999*gbyte && m_SizeBytes < 2049*gbyte) { + m_Size = "2 TB"; } +// } if (m_Interface.contains("USB", Qt::CaseInsensitive)) { if (m_SizeBytes > 15*gbyte && m_SizeBytes < 17*gbyte) { m_Size = "16 GB"; From 4b2ff1c611e595cc0cba278a853993e406886b72 Mon Sep 17 00:00:00 2001 From: zhanghongyuan Date: Wed, 26 Feb 2025 11:29:18 +0800 Subject: [PATCH 28/69] fix: the get info from edit in order fix the get info from edit in order read the edid info from system may not in order. Log: fix the get info from edit in order Bug: https://pms.uniontech.com/bug-view-305295.html Change-Id: I5c124f5fd431b1e4a78eaeacd5c748b5fee0c6e7 --- deepin-devicemanager/src/GenerateDevice/HWGenerator.cpp | 2 +- deepin-devicemanager/src/Tool/ThreadExecXrandr.cpp | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/deepin-devicemanager/src/GenerateDevice/HWGenerator.cpp b/deepin-devicemanager/src/GenerateDevice/HWGenerator.cpp index 597983182..5b77154d1 100644 --- a/deepin-devicemanager/src/GenerateDevice/HWGenerator.cpp +++ b/deepin-devicemanager/src/GenerateDevice/HWGenerator.cpp @@ -465,7 +465,7 @@ void HWGenerator::generatorMonitorDevice() if (!toDir_.exists()) return; - QFileInfoList fileInfoList = toDir_.entryInfoList(); + QFileInfoList fileInfoList = toDir_.entryInfoList(QDir::NoFilter, QDir::Name); foreach(QFileInfo fileInfo, fileInfoList) { if (fileInfo.fileName() == "." || fileInfo.fileName() == ".." || !fileInfo.fileName().startsWith("card")) continue; diff --git a/deepin-devicemanager/src/Tool/ThreadExecXrandr.cpp b/deepin-devicemanager/src/Tool/ThreadExecXrandr.cpp index a952e0b47..0193f307a 100644 --- a/deepin-devicemanager/src/Tool/ThreadExecXrandr.cpp +++ b/deepin-devicemanager/src/Tool/ThreadExecXrandr.cpp @@ -231,7 +231,9 @@ void ThreadExecXrandr::getMonitorInfoFromXrandrVerbose() { QList> lstMap; loadXrandrVerboseInfo(lstMap, "xrandr --verbose"); - std::reverse(lstMap.begin(), lstMap.end()); + if (Common::specialComType == Common::SpecialComputerType::NormalCom) { + std::reverse(lstMap.begin(), lstMap.end()); + } QList >::const_iterator it = lstMap.begin(); for (; it != lstMap.end(); ++it) { if ((*it).size() < 1) From ed89899a1f341c05900b949481e0527f9a5fca6f Mon Sep 17 00:00:00 2001 From: add-uos <164976197+add-uos@users.noreply.github.com> Date: Tue, 11 Mar 2025 17:37:33 +0800 Subject: [PATCH 29/69] fix: the monitor info in single screen mode (#436) fix the monitor info in single screen mode. Log: fix the monitor info in single screen mode. Bug: https://pms.uniontech.com/bug-view-305295.html --- deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp b/deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp index b00d81f5e..f3af2afae 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp @@ -178,6 +178,15 @@ bool DeviceMonitor::setInfoFromXradr(const QString &main, const QString &edid, c { if(m_IsTomlSet) return false; + + for(auto it: m_LstBaseInfo){ + if (it.first.contains("Display Input")){ + if (!main.contains(it.second, Qt::CaseInsensitive)) { + return false; + } + } + } + // 判断该显示器设备是否已经设置过从xrandr获取的消息 if (!m_Interface.isEmpty()) { // 设置当前分辨率 From 899d8b4ab102836a3d1ccca47cf4d655a4767d03 Mon Sep 17 00:00:00 2001 From: add-uos <164976197+add-uos@users.noreply.github.com> Date: Mon, 14 Apr 2025 13:36:38 +0800 Subject: [PATCH 30/69] fix: get the storage size info from smartctl (#450) fix get the storage size info from smartctl Log: fix get the storage size info from smartctl. Bug: https://pms.uniontech.com/bug-view-312479.html Change-Id: I5ee5e270c0d5170d4c950d82bf028a0c6023693f --- .../src/DeviceManager/DeviceStorage.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/deepin-devicemanager/src/DeviceManager/DeviceStorage.cpp b/deepin-devicemanager/src/DeviceManager/DeviceStorage.cpp index 42a5c34c9..0b7f1dbcf 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceStorage.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceStorage.cpp @@ -5,6 +5,7 @@ // 项目自身文件 #include "DeviceStorage.h" #include "commonfunction.h" +#include #include // Qt库文件 @@ -477,16 +478,16 @@ QString DeviceStorage::compareSize(const QString &size1, const QString &size2) return size1 + size2; // 将字符串转为数字大小进行比较 - int num1 = 0; - int num2 = 0; - QRegExp reg(".*\\[(\\d*).*\\]$"); + float num1 = 0; + float num2 = 0; + QRegExp reg(".*\\[(\\d+\\.?\\d+).*\\]"); if (reg.exactMatch(size1)) - num1 = reg.cap(1).toInt(); + num1 = reg.cap(1).toFloat(); if (reg.exactMatch(size2)) - num2 = reg.cap(1).toInt(); + num2 = reg.cap(1).toFloat(); // 返回较大值 - if (num1 > num2) + if ((num1 - num2) > FLT_EPSILON * fmaxf(fabsf(num1), fabsf(num2))) return size1; else return size2; @@ -685,6 +686,9 @@ void DeviceStorage::getInfoFromsmartctl(const QMap &mapInfo) capacity.replace(",","").replace(" ",""); QRegExp re("(\\d+)bytes*"); //取值格式如: User Capacity: 1,000,204,886,016 bytes [1.00 TB] Total NVM Capacity: 256,060,514,304 [256 GB] + if (!capacity.contains("bytes", Qt::CaseInsensitive)) { + re.setPattern("(\\d+)"); + } int pos = re.indexIn(capacity); if (pos != -1) { QString byteSize = re.cap(1); From 9a46594d310445688c837026581ab205750c60b8 Mon Sep 17 00:00:00 2001 From: add-uos <164976197+add-uos@users.noreply.github.com> Date: Mon, 28 Apr 2025 14:49:32 +0800 Subject: [PATCH 31/69] fix: the monitor display info in special machine (#453) fix the monitor display info in special machine Log: fix the monitor display info in special machine Bug: https://pms.uniontech.com/bug-view-310413.html --- .../src/DeviceManager/DeviceMonitor.cpp | 22 +++++++++---------- .../src/GenerateDevice/HWGenerator.cpp | 2 +- deepin-devicemanager/src/Tool/EDIDParser.cpp | 2 +- .../src/Tool/ThreadExecXrandr.cpp | 6 ++--- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp b/deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp index f3af2afae..3a50f0d44 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp @@ -200,9 +200,9 @@ bool DeviceMonitor::setInfoFromXradr(const QString &main, const QString &edid, c if (pos > 0 && curRate.size() > pos && !Common::boardVendorType().isEmpty()) { curRate = QString::number(ceil(curRate.left(pos).toDouble())) + curRate.right(curRate.size() - pos); } - m_CurrentResolution = QString("%1@%2").arg(reScreenSize.cap(1)).arg(curRate); + m_CurrentResolution = QString("%1@%2").arg(reScreenSize.cap(1)).arg(curRate).replace("x", "×", Qt::CaseInsensitive); } else - m_CurrentResolution = QString("%1").arg(reScreenSize.cap(1)); + m_CurrentResolution = QString("%1").arg(reScreenSize.cap(1)).replace("x", "×", Qt::CaseInsensitive); } } return false; @@ -275,12 +275,12 @@ void DeviceMonitor::initFilterKey() void DeviceMonitor::loadBaseDeviceInfo() { // 添加基本信息 - if (Common::specialComType != 6) + if (Common::specialComType != 6 && Common::specialComType != 5) { addBaseDeviceInfo(("Name"), m_Name); - addBaseDeviceInfo(("Vendor"), m_Vendor); - if (Common::specialComType != 6) + addBaseDeviceInfo(("Vendor"), m_Vendor); addBaseDeviceInfo(("Type"), m_Model); - addBaseDeviceInfo(("Display Input"), m_DisplayInput); + addBaseDeviceInfo(("Display Input"), m_DisplayInput); + } addBaseDeviceInfo(("Interface Type"), m_Interface); } @@ -353,12 +353,12 @@ bool DeviceMonitor::setMainInfoFromXrandr(const QString &info, const QString &ra m_RefreshRate = QString("%1").arg(curRate); } if (Common::specialComType == 5 || Common::specialComType == 6) { - m_CurrentResolution = QString("%1").arg(reScreenSize.cap(1)); + m_CurrentResolution = QString("%1").arg(reScreenSize.cap(1)).replace("x", "×", Qt::CaseInsensitive); } else { - m_CurrentResolution = QString("%1 @%2").arg(reScreenSize.cap(1)).arg(curRate); + m_CurrentResolution = QString("%1 @%2").arg(reScreenSize.cap(1)).arg(curRate).replace("x", "×", Qt::CaseInsensitive); } } else - m_CurrentResolution = QString("%1").arg(reScreenSize.cap(1)); + m_CurrentResolution = QString("%1").arg(reScreenSize.cap(1)).replace("x", "×", Qt::CaseInsensitive); } return true; @@ -419,7 +419,7 @@ void DeviceMonitor::caculateScreenSize() m_Height = re.cap(2).toInt(); double inch = std::sqrt((m_Width / 2.54) * (m_Width / 2.54) + (m_Height / 2.54) * (m_Height / 2.54)) / 10.0; - m_ScreenSize = QString("%1 %2(%3mm X %4mm)").arg(QString::number(inch, '0', 1)).arg(translateStr("inch")).arg(m_Width).arg(m_Height); + m_ScreenSize = QString("%1 %2(%3mm×%4mm)").arg(QString::number(inch, '0', 1)).arg(translateStr("inch")).arg(m_Width).arg(m_Height); } } @@ -449,6 +449,6 @@ bool DeviceMonitor::caculateScreenSize(const QString &edid) return true; double inch = std::sqrt(height * height + width * width) / 2.54 / 10; - m_ScreenSize = QString("%1 %2(%3mm X %4mm)").arg(QString::number(inch, '0', 1)).arg(translateStr("inch")).arg(width).arg(height); + m_ScreenSize = QString("%1 %2(%3mm×%4mm)").arg(QString::number(inch, '0', 1)).arg(translateStr("inch")).arg(width).arg(height); return true; } diff --git a/deepin-devicemanager/src/GenerateDevice/HWGenerator.cpp b/deepin-devicemanager/src/GenerateDevice/HWGenerator.cpp index 5b77154d1..33b4aee1a 100644 --- a/deepin-devicemanager/src/GenerateDevice/HWGenerator.cpp +++ b/deepin-devicemanager/src/GenerateDevice/HWGenerator.cpp @@ -446,7 +446,7 @@ static void parseEDID(QStringList allEDIDS,QString input) QMap mapInfo; mapInfo.insert("Vendor",edidParser.vendor()); mapInfo.insert("Model",edidParser.model()); - mapInfo.insert("Date",edidParser.releaseDate()); + //mapInfo.insert("Date",edidParser.releaseDate()); mapInfo.insert("Size",edidParser.screenSize()); mapInfo.insert("Display Input",input); diff --git a/deepin-devicemanager/src/Tool/EDIDParser.cpp b/deepin-devicemanager/src/Tool/EDIDParser.cpp index 26dd3ea5e..fa6cb7de7 100644 --- a/deepin-devicemanager/src/Tool/EDIDParser.cpp +++ b/deepin-devicemanager/src/Tool/EDIDParser.cpp @@ -192,7 +192,7 @@ void EDIDParser::parseScreenSize() } double inch = sqrt((m_Width / 2.54) * (m_Width / 2.54) + (m_Height / 2.54) * (m_Height / 2.54))/10; - m_ScreenSize = QString("%1 %2(%3mm X %4mm)").arg(QString::number(inch, '0', 1)).arg(QObject::tr("inch")).arg(m_Width).arg(m_Height); + m_ScreenSize = QString("%1 %2(%3mm×%4mm)").arg(QString::number(inch, '0', 1)).arg(QObject::tr("inch")).arg(m_Width).arg(m_Height); } QString EDIDParser::binToDec(QString strBin) //二进制转十进制 diff --git a/deepin-devicemanager/src/Tool/ThreadExecXrandr.cpp b/deepin-devicemanager/src/Tool/ThreadExecXrandr.cpp index 0193f307a..03194c6d4 100644 --- a/deepin-devicemanager/src/Tool/ThreadExecXrandr.cpp +++ b/deepin-devicemanager/src/Tool/ThreadExecXrandr.cpp @@ -330,8 +330,8 @@ void ThreadExecXrandr::getResolutionFromDBus(QMap &lstMap) } if (maxResolutionWidth != -1) { - lstMap.insert("maxResolution", QString("%1 x %2").arg(maxResolutionWidth).arg(maxResolutionHeight)); - lstMap.insert("minResolution", QString("%1 x %2").arg(minResolutionWidth).arg(minResolutionHeight)); + lstMap.insert("maxResolution", QString("%1×%2").arg(maxResolutionWidth).arg(maxResolutionHeight)); + lstMap.insert("minResolution", QString("%1×%2").arg(minResolutionWidth).arg(minResolutionHeight)); } } @@ -409,7 +409,7 @@ void ThreadExecXrandr::getResolutionRateFromDBus(QList > curResolutionHeight = resolution.height; resRate = resolution.refreshRate; QMapinfoMap; - QString tmpS = QString("%1 x %2 @").arg(curResolutionWidth).arg(curResolutionHeight) + QString::number(resRate, 'f', 2); + QString tmpS = QString("%1×%2@").arg(curResolutionWidth).arg(curResolutionHeight) + QString::number(resRate, 'f', 2); infoMap.insert("CurResolution", tmpS + "Hz"); infoMap.insert("Name", tname.toString()); infoMap.insert("Display Input", tname.toString()); From 2e1f8eaa80518d758d208ab8ab46472e457ed7c7 Mon Sep 17 00:00:00 2001 From: zhanghongyuan Date: Tue, 29 Apr 2025 10:09:49 +0800 Subject: [PATCH 32/69] fix: the audio device registe two pci device can't be disable the audio device registe two pci device can't be disable Log: fix the audio device registe two pci device can't be disable Bug: https://pms.uniontech.com/bug-view-314495.html Change-Id: I40efcebcf8e8e5942b768c7fc5d394ab100494be --- deepin-devicemanager/src/GenerateDevice/CmdTool.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/deepin-devicemanager/src/GenerateDevice/CmdTool.cpp b/deepin-devicemanager/src/GenerateDevice/CmdTool.cpp index d21582547..6712da5d7 100644 --- a/deepin-devicemanager/src/GenerateDevice/CmdTool.cpp +++ b/deepin-devicemanager/src/GenerateDevice/CmdTool.cpp @@ -587,7 +587,18 @@ void CmdTool::getMulHwinfoInfo(const QString &info) getMapInfoFromHwinfo(item, mapInfo); if (mapInfo["Hardware Class"] == "sound" || mapInfo["Device"].contains("USB Audio")) { // mapInfo["Device"].contains("USB Audio") 是为了处理未识别的USB声卡 Bug-118773 - addMapInfo("hwinfo_sound", mapInfo); + const QList> &lstMap = m_cmdInfo["hwinfo_sound"]; + QList >::const_iterator it = lstMap.begin(); + bool canAdd = true; + for (; it != lstMap.end(); ++it) { + auto item = *it; + if (item.value("Device") == mapInfo["Device"] && item.value("Hardware Class") != "sound") { + canAdd = false; + } + } + if (canAdd) { + addMapInfo("hwinfo_sound", mapInfo); + } } else if (mapInfo["Hardware Class"].contains("network")) { addMapInfo("hwinfo_network", mapInfo); } else if ("keyboard" == mapInfo["Hardware Class"]) { From 12eaa7c4efc6865599c4c9131785841389c9669a Mon Sep 17 00:00:00 2001 From: zhanghongyuan Date: Tue, 29 Apr 2025 19:11:31 +0800 Subject: [PATCH 33/69] fix: the audio device may cause crush fix the audio device may cause crush Log: fix the audio device may cause crush. Bug: https://pms.uniontech.com/bug-view-314495.html Change-Id: Ic86b50fca4e37ad5317a37334a13273a51fba772 --- deepin-devicemanager/src/GenerateDevice/CmdTool.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deepin-devicemanager/src/GenerateDevice/CmdTool.cpp b/deepin-devicemanager/src/GenerateDevice/CmdTool.cpp index 6712da5d7..76119df9b 100644 --- a/deepin-devicemanager/src/GenerateDevice/CmdTool.cpp +++ b/deepin-devicemanager/src/GenerateDevice/CmdTool.cpp @@ -592,7 +592,7 @@ void CmdTool::getMulHwinfoInfo(const QString &info) bool canAdd = true; for (; it != lstMap.end(); ++it) { auto item = *it; - if (item.value("Device") == mapInfo["Device"] && item.value("Hardware Class") != "sound") { + if (item.value("Device") == mapInfo["Device"] && mapInfo.value("Hardware Class") != "sound") { canAdd = false; } } From 8e794c9e0224e254330435f2005a2cebfb5bc00e Mon Sep 17 00:00:00 2001 From: zhanghongyuan Date: Thu, 8 May 2025 14:16:04 +0800 Subject: [PATCH 34/69] fix: fit multiple audio device enable function fit multiple audio device enable function Log: fit multiple audio device enable function Bug: https://pms.uniontech.com/bug-view-314495.html Change-Id: Ibbd0c06d0112b5964d2f0dd9854aa8f629f8ccd1 --- .../src/DeviceManager/DeviceAudio.cpp | 2 +- .../src/DeviceManager/DeviceInfo.cpp | 5 +++ .../src/DeviceManager/DeviceInfo.h | 1 + .../src/DeviceManager/DeviceManager.cpp | 33 +++++++++++-------- .../src/GenerateDevice/CmdTool.cpp | 13 +------- .../src/GenerateDevice/DeviceGenerator.cpp | 6 +++- 6 files changed, 33 insertions(+), 27 deletions(-) diff --git a/deepin-devicemanager/src/DeviceManager/DeviceAudio.cpp b/deepin-devicemanager/src/DeviceManager/DeviceAudio.cpp index ad43778b4..8f1020094 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceAudio.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceAudio.cpp @@ -263,7 +263,7 @@ const QString &DeviceAudio::driver() const } const QString &DeviceAudio::uniqueID() const { - return m_SysPath; + return m_UniqueID; } EnableDeviceStatus DeviceAudio::setEnable(bool e) { diff --git a/deepin-devicemanager/src/DeviceManager/DeviceInfo.cpp b/deepin-devicemanager/src/DeviceManager/DeviceInfo.cpp index 6e6331d86..1e6940773 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceInfo.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceInfo.cpp @@ -1248,3 +1248,8 @@ void DeviceBaseInfo::generatorTranslate() << tr("Vendor") \ << tr("Processor"); } + +void DeviceBaseInfo::setUniqueID(const QString &UniqueID) +{ + m_UniqueID = UniqueID; +} diff --git a/deepin-devicemanager/src/DeviceManager/DeviceInfo.h b/deepin-devicemanager/src/DeviceManager/DeviceInfo.h index bd975caa0..7aa802cf6 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceInfo.h +++ b/deepin-devicemanager/src/DeviceManager/DeviceInfo.h @@ -394,6 +394,7 @@ class DeviceBaseInfo : public QObject */ TomlFixMethod setInfoFromTomlBase(const QMap &mapInfo); + void setUniqueID(const QString &UniqueID); protected: /** * @brief:初始化过滤信息 diff --git a/deepin-devicemanager/src/DeviceManager/DeviceManager.cpp b/deepin-devicemanager/src/DeviceManager/DeviceManager.cpp index 8fd576ac4..f68585520 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceManager.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceManager.cpp @@ -1111,21 +1111,28 @@ void DeviceManager::delAudioDevice(DeviceAudio *const device) void DeviceManager::deleteDisableDuplicate_AudioDevice(void) { - if (m_ListDeviceAudio.size() > 0) { - for (QList::iterator it = m_ListDeviceAudio.begin(); it != m_ListDeviceAudio.end(); ++it) { - DeviceAudio *audio_1 = dynamic_cast(*it); - //QString tpath = audio_1->uniqueID(); - // 判断该设备是否已经存在, - if (!audio_1->enable()) { - for (QList::iterator it2 = m_ListDeviceAudio.begin(); it2 != m_ListDeviceAudio.end(); ++it2) { - DeviceAudio *audio_2 = dynamic_cast(*it2); - if (audio_2->name() == audio_1->name()) - if (audio_2->enable()) - m_ListDeviceAudio.removeOne(audio_2); - } - } + QHash enabledDevices; + for (auto it = m_ListDeviceAudio.begin(); it != m_ListDeviceAudio.end(); ++it) { + DeviceAudio* audio = dynamic_cast(*it); + if (!audio) { + continue; } + if (audio->enable() || !enabledDevices.contains(audio->uniqueID())) { + QString usbDir = "/sys" + audio->sysPath(); + if (QFileInfo::exists(usbDir) || !audio->driver().contains("usb")) { + enabledDevices[audio->uniqueID()] = audio; + } + } else { + if (enabledDevices.contains(audio->uniqueID()) && enabledDevices[audio->uniqueID()]->enable()) { + delete enabledDevices[audio->uniqueID()]; + enabledDevices[audio->uniqueID()] = audio; + } + } + } + m_ListDeviceAudio.clear(); + for(auto it : enabledDevices.values()){ + m_ListDeviceAudio.push_back(it); } } diff --git a/deepin-devicemanager/src/GenerateDevice/CmdTool.cpp b/deepin-devicemanager/src/GenerateDevice/CmdTool.cpp index 76119df9b..d21582547 100644 --- a/deepin-devicemanager/src/GenerateDevice/CmdTool.cpp +++ b/deepin-devicemanager/src/GenerateDevice/CmdTool.cpp @@ -587,18 +587,7 @@ void CmdTool::getMulHwinfoInfo(const QString &info) getMapInfoFromHwinfo(item, mapInfo); if (mapInfo["Hardware Class"] == "sound" || mapInfo["Device"].contains("USB Audio")) { // mapInfo["Device"].contains("USB Audio") 是为了处理未识别的USB声卡 Bug-118773 - const QList> &lstMap = m_cmdInfo["hwinfo_sound"]; - QList >::const_iterator it = lstMap.begin(); - bool canAdd = true; - for (; it != lstMap.end(); ++it) { - auto item = *it; - if (item.value("Device") == mapInfo["Device"] && mapInfo.value("Hardware Class") != "sound") { - canAdd = false; - } - } - if (canAdd) { - addMapInfo("hwinfo_sound", mapInfo); - } + addMapInfo("hwinfo_sound", mapInfo); } else if (mapInfo["Hardware Class"].contains("network")) { addMapInfo("hwinfo_network", mapInfo); } else if ("keyboard" == mapInfo["Hardware Class"]) { diff --git a/deepin-devicemanager/src/GenerateDevice/DeviceGenerator.cpp b/deepin-devicemanager/src/GenerateDevice/DeviceGenerator.cpp index 23e445b59..78295b7f6 100644 --- a/deepin-devicemanager/src/GenerateDevice/DeviceGenerator.cpp +++ b/deepin-devicemanager/src/GenerateDevice/DeviceGenerator.cpp @@ -741,13 +741,17 @@ void DeviceGenerator::getAudioInfoFromHwinfo() QString path = pciPath(*it); DeviceAudio *device = dynamic_cast(DeviceManager::instance()->getAudioDevice(path)); - if (device) { + if (device && (*it).size() != 5) { device->setEnableValue(false); continue; } device = new DeviceAudio(); device->setInfoFromHwinfo(*it); + if ((*it).size() == 5 && (*it).find("unique_id") != (*it).end()) { + device->setEnableValue(false); + device->setUniqueID((*it)["unique_id"]); + } DeviceManager::instance()->addAudioDevice(device); addBusIDFromHwinfo((*it)["SysFS BusID"]); } From cf8924cc30c28f436ee23f4fd3d5b76360282fcf Mon Sep 17 00:00:00 2001 From: zhanghongyuan Date: Thu, 15 May 2025 10:52:22 +0800 Subject: [PATCH 35/69] fix: modify the mouse device name modify the mouse device name Log: modify the mouse device name Bug: https://pms.uniontech.com/task-view-376575.html Change-Id: I37339a5ec25d6fbe5b4cb4f209ba1f7fa7f87cec --- deepin-devicemanager/src/Page/PageListView.cpp | 2 +- deepin-devicemanager/translations/deepin-devicemanager.ts | 2 +- deepin-devicemanager/translations/deepin-devicemanager_zh_CN.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/deepin-devicemanager/src/Page/PageListView.cpp b/deepin-devicemanager/src/Page/PageListView.cpp index 17bf91cbc..ff226cdfe 100644 --- a/deepin-devicemanager/src/Page/PageListView.cpp +++ b/deepin-devicemanager/src/Page/PageListView.cpp @@ -28,7 +28,7 @@ PageListView::PageListView(DWidget *parent) hLayout->setContentsMargins(0, 0, 0, 0); setLayout(hLayout); - this->setFixedWidth(152); + this->setFixedWidth(172); // 初始化右键菜单 mp_ListView->setContextMenuPolicy(Qt::CustomContextMenu); connect(mp_ListView, SIGNAL(customContextMenuRequested(const QPoint &)), diff --git a/deepin-devicemanager/translations/deepin-devicemanager.ts b/deepin-devicemanager/translations/deepin-devicemanager.ts index 4de3642db..0d869b005 100644 --- a/deepin-devicemanager/translations/deepin-devicemanager.ts +++ b/deepin-devicemanager/translations/deepin-devicemanager.ts @@ -841,7 +841,7 @@ Mouse - Mouse + Mouse and Pointer Devices diff --git a/deepin-devicemanager/translations/deepin-devicemanager_zh_CN.ts b/deepin-devicemanager/translations/deepin-devicemanager_zh_CN.ts index 3b2c84748..712acdba2 100644 --- a/deepin-devicemanager/translations/deepin-devicemanager_zh_CN.ts +++ b/deepin-devicemanager/translations/deepin-devicemanager_zh_CN.ts @@ -1852,7 +1852,7 @@ Mouse - 鼠标 + 鼠标与指针设备 From 480a9ef8e37a030b445af00a0e72a789e7d96d79 Mon Sep 17 00:00:00 2001 From: zhanghongyuan Date: Mon, 19 May 2025 11:01:55 +0800 Subject: [PATCH 36/69] fix the USB audio device can't be disable fix the USB audio device can't be disable Log: fix the USB audio device can't be disable Bug: https://pms.uniontech.com/bug-view-316525.html Change-Id: I2e8d4f70d3b5c8d029c92386025ed974a1797bb5 --- .../src/controlinterface.cpp | 4 +- .../src/enablecontrol/enablesqlmanager.cpp | 19 ++++-- .../src/enablecontrol/enablesqlmanager.h | 4 +- .../src/DeviceManager/DeviceInfo.cpp | 5 ++ .../src/DeviceManager/DeviceInfo.h | 2 + .../src/DeviceManager/DeviceManager.cpp | 62 ++++++++++++++++--- .../src/DeviceManager/DeviceManager.h | 2 + .../src/GenerateDevice/CmdTool.cpp | 2 +- .../src/GenerateDevice/DeviceGenerator.cpp | 2 +- 9 files changed, 83 insertions(+), 19 deletions(-) diff --git a/deepin-devicemanager-server/deepin-devicecontrol/src/controlinterface.cpp b/deepin-devicemanager-server/deepin-devicecontrol/src/controlinterface.cpp index 561cdecc1..23f19260d 100644 --- a/deepin-devicemanager-server/deepin-devicecontrol/src/controlinterface.cpp +++ b/deepin-devicemanager-server/deepin-devicecontrol/src/controlinterface.cpp @@ -140,9 +140,7 @@ bool ControlInterface::enable(const QString &hclass, const QString &name, const // 先从数据库中查找路径,防止设备更换usb接口 QString sPath = EnableSqlManager::getInstance()->authorizedPath(value); - if (sPath.isEmpty()) { - sPath = path; - } + sPath = path; // 判断是内置设备,还是外设,内置设备通过remove文件禁用,外设通过authorized文件禁用 bool res = false; diff --git a/deepin-devicemanager-server/deepin-devicecontrol/src/enablecontrol/enablesqlmanager.cpp b/deepin-devicemanager-server/deepin-devicecontrol/src/enablecontrol/enablesqlmanager.cpp index dbb27f3e4..f39d6a88a 100644 --- a/deepin-devicemanager-server/deepin-devicecontrol/src/enablecontrol/enablesqlmanager.cpp +++ b/deepin-devicemanager-server/deepin-devicecontrol/src/enablecontrol/enablesqlmanager.cpp @@ -52,14 +52,17 @@ void EnableSqlManager::removeDateFromRemoveTable(const QString &path) void EnableSqlManager::insertDataToAuthorizedTable(const QString &hclass, const QString &name, const QString &path, const QString &unique_id, bool exist, const QString &strDriver) { // 数据库已经存在该设备记录 - if (uniqueIDExistedEX(unique_id)) { + if (uniqueIDExistedEX(unique_id, path)) { return; } // 数据库没有该设备记录,则直接插入 // QString sql = QString("INSERT INTO %1 (class, name, path, unique_id, exist, driver) VALUES (%2, %3, %4, %5, %6, %7);") // .arg(DB_TABLE_AUTHORIZED).arg(":hclass").arg(":name").arg(":path").arg(":unique_id").arg(":exist").arg(":strDriver"); - if(!m_sqlQuery.prepare("INSERT INTO authorized (class, name, path, unique_id, exist, driver) VALUES (:hclass, :name, :path, :unique_id, :exist, :strDriver);")) return; + if(!m_sqlQuery.prepare("INSERT INTO authorized (class, name, path, unique_id, exist, driver) VALUES (:hclass, :name, :path, :unique_id, :exist, :strDriver);")){ + qDebug() << "insert data to authorized table failed"; + return; + } m_sqlQuery.bindValue(":hclass", QVariant(hclass)); m_sqlQuery.bindValue(":name", QVariant(name)); m_sqlQuery.bindValue(":path", QVariant(path)); @@ -124,20 +127,26 @@ void EnableSqlManager::removeDataFromPrinterTable(const QString &name) } } -bool EnableSqlManager::uniqueIDExisted(const QString &key) +bool EnableSqlManager::uniqueIDExisted(const QString &key, const QString path) { QString sql = QString("SELECT COUNT(*) FROM %1 WHERE unique_id=%2;").arg(DB_TABLE_AUTHORIZED).arg(":param"); + if (!path.isEmpty()){ + sql = QString("SELECT COUNT(*) FROM %1 WHERE unique_id=%2 and path=%3;").arg(DB_TABLE_AUTHORIZED).arg(":param").arg(":path"); + } if(!m_sqlQuery.prepare(sql)) return false; m_sqlQuery.bindValue(":param", QVariant(key)); + if (!path.isEmpty()){ + m_sqlQuery.bindValue(":path", QVariant(path)); + } if (m_sqlQuery.exec() && m_sqlQuery.next()) { return m_sqlQuery.value(0).toInt() > 0; } return false; } -bool EnableSqlManager::uniqueIDExistedEX(const QString &key) +bool EnableSqlManager::uniqueIDExistedEX(const QString &key, const QString path) { - return uniqueIDExisted(key); + return uniqueIDExisted(key, path); } bool EnableSqlManager::isUniqueIdEnabled(const QString &key) diff --git a/deepin-devicemanager-server/deepin-devicecontrol/src/enablecontrol/enablesqlmanager.h b/deepin-devicemanager-server/deepin-devicecontrol/src/enablecontrol/enablesqlmanager.h index 273fe9325..6c8d7a870 100644 --- a/deepin-devicemanager-server/deepin-devicecontrol/src/enablecontrol/enablesqlmanager.h +++ b/deepin-devicemanager-server/deepin-devicecontrol/src/enablecontrol/enablesqlmanager.h @@ -90,14 +90,14 @@ class EnableSqlManager : public QObject * @param key * @return */ - bool uniqueIDExisted(const QString &key); + bool uniqueIDExisted(const QString &key, const QString path = ""); /** * @brief uniqueIDExistedForEnable * @param key * @return */ - bool uniqueIDExistedEX(const QString &key); + bool uniqueIDExistedEX(const QString &key, const QString path = ""); /** * @brief isUniqueIdEnabled 判断设备是否被禁用了 diff --git a/deepin-devicemanager/src/DeviceManager/DeviceInfo.cpp b/deepin-devicemanager/src/DeviceManager/DeviceInfo.cpp index 1e6940773..082a90c5b 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceInfo.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceInfo.cpp @@ -1249,6 +1249,11 @@ void DeviceBaseInfo::generatorTranslate() << tr("Processor"); } +void DeviceBaseInfo::setSysPath(const QString &newSysPath) +{ + m_SysPath = newSysPath; +} + void DeviceBaseInfo::setUniqueID(const QString &UniqueID) { m_UniqueID = UniqueID; diff --git a/deepin-devicemanager/src/DeviceManager/DeviceInfo.h b/deepin-devicemanager/src/DeviceManager/DeviceInfo.h index 7aa802cf6..6be90b657 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceInfo.h +++ b/deepin-devicemanager/src/DeviceManager/DeviceInfo.h @@ -395,6 +395,8 @@ class DeviceBaseInfo : public QObject TomlFixMethod setInfoFromTomlBase(const QMap &mapInfo); void setUniqueID(const QString &UniqueID); + void setSysPath(const QString &newSysPath); + protected: /** * @brief:初始化过滤信息 diff --git a/deepin-devicemanager/src/DeviceManager/DeviceManager.cpp b/deepin-devicemanager/src/DeviceManager/DeviceManager.cpp index f68585520..376af363a 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceManager.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceManager.cpp @@ -1112,28 +1112,76 @@ void DeviceManager::delAudioDevice(DeviceAudio *const device) void DeviceManager::deleteDisableDuplicate_AudioDevice(void) { QHash enabledDevices; + QHash enableDevicePriority; for (auto it = m_ListDeviceAudio.begin(); it != m_ListDeviceAudio.end(); ++it) { DeviceAudio* audio = dynamic_cast(*it); if (!audio) { continue; } - if (audio->enable() || !enabledDevices.contains(audio->uniqueID())) { - QString usbDir = "/sys" + audio->sysPath(); - if (QFileInfo::exists(usbDir) || !audio->driver().contains("usb")) { - enabledDevices[audio->uniqueID()] = audio; + if (audio->enable() || !enabledDevices.contains(audio->uniqueID())) { + enabledDevices[audio->uniqueID()] = audio; + if (!enableDevicePriority.contains(audio->uniqueID())) { + if (audio->enable() || ! audio->driver().contains("usb")) { + enableDevicePriority.insert(audio->uniqueID(), 2); + } else { + enableDevicePriority.insert(audio->uniqueID(), 1); + } + } else { + enableDevicePriority[audio->uniqueID()] = enableDevicePriority[audio->uniqueID()] + 1; } } else { if (enabledDevices.contains(audio->uniqueID()) && enabledDevices[audio->uniqueID()]->enable()) { + if (!enableDevicePriority.contains(audio->uniqueID())) { + if (audio->enable()) { + enableDevicePriority.insert(audio->uniqueID(), 2); + } else { + enableDevicePriority.insert(audio->uniqueID(), 1); + } + } else { + enableDevicePriority[audio->uniqueID()] = enableDevicePriority[audio->uniqueID()] + 1; + } + audio->setSysPath(enabledDevices[audio->uniqueID()]->sysPath()); delete enabledDevices[audio->uniqueID()]; - enabledDevices[audio->uniqueID()] = audio; } } } + qWarning()<<"delete before: "<< m_ListDeviceAudio.size(); + qWarning() << enableDevicePriority; m_ListDeviceAudio.clear(); - for(auto it : enabledDevices.values()){ - m_ListDeviceAudio.push_back(it); + for(auto it : enabledDevices.keys()){ + if (enableDevicePriority.value(it) <= 1) { + continue; + } + m_ListDeviceAudio.push_back(enabledDevices.value(it)); + + setAudioDeviceEnable(enabledDevices.value(it), enabledDevices.value(it)->enable()); } + qWarning()<<"delete after: "<< m_ListDeviceAudio.size(); +} + +void DeviceManager::setAudioDeviceEnable(DeviceAudio * const devivce, bool enable) +{ + EnableDeviceStatus status ; + + int i = 0; + do{ + status = devivce->setEnable(enable); + if (status == EDS_Success) { + break; + } + qWarning() << "retry: " << ++i; + }while (i < 3); + + qWarning() << [](EnableDeviceStatus status) { + switch(status) { + case EDS_Cancle: return "Device enable operation was cancelled"; + case EDS_NoSerial: return "Device enable failed: No serial number available"; + case EDS_Faild: return "-----Device enable failed due to unknown error"; + case EDS_Success: return "Device enabled successfully"; + default: return "Unknown device enable status"; + } + }(status); } DeviceBaseInfo *DeviceManager::getAudioDevice(const QString &path) diff --git a/deepin-devicemanager/src/DeviceManager/DeviceManager.h b/deepin-devicemanager/src/DeviceManager/DeviceManager.h index a2682366b..085422891 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceManager.h +++ b/deepin-devicemanager/src/DeviceManager/DeviceManager.h @@ -331,6 +331,8 @@ class DeviceManager : public QObject */ void deleteDisableDuplicate_AudioDevice(void); + void setAudioDeviceEnable(DeviceAudio *const devivce, bool enable); + /** * @brief getAudioDevice 获取音频设备 * @param path diff --git a/deepin-devicemanager/src/GenerateDevice/CmdTool.cpp b/deepin-devicemanager/src/GenerateDevice/CmdTool.cpp index d21582547..1679baa77 100644 --- a/deepin-devicemanager/src/GenerateDevice/CmdTool.cpp +++ b/deepin-devicemanager/src/GenerateDevice/CmdTool.cpp @@ -585,7 +585,7 @@ void CmdTool::getMulHwinfoInfo(const QString &info) continue; QMap mapInfo; getMapInfoFromHwinfo(item, mapInfo); - if (mapInfo["Hardware Class"] == "sound" || mapInfo["Device"].contains("USB Audio")) { + if (mapInfo["Hardware Class"] == "sound" || (mapInfo["Device"].contains("USB Audio") && mapInfo["Device"].contains("snd-usb-audio"))) { // mapInfo["Device"].contains("USB Audio") 是为了处理未识别的USB声卡 Bug-118773 addMapInfo("hwinfo_sound", mapInfo); } else if (mapInfo["Hardware Class"].contains("network")) { diff --git a/deepin-devicemanager/src/GenerateDevice/DeviceGenerator.cpp b/deepin-devicemanager/src/GenerateDevice/DeviceGenerator.cpp index 78295b7f6..859dfb0f5 100644 --- a/deepin-devicemanager/src/GenerateDevice/DeviceGenerator.cpp +++ b/deepin-devicemanager/src/GenerateDevice/DeviceGenerator.cpp @@ -755,7 +755,7 @@ void DeviceGenerator::getAudioInfoFromHwinfo() DeviceManager::instance()->addAudioDevice(device); addBusIDFromHwinfo((*it)["SysFS BusID"]); } - DeviceManager::instance()->deleteDisableDuplicate_AudioDevice(); +// DeviceManager::instance()->deleteDisableDuplicate_AudioDevice(); } void DeviceGenerator::getAudioInfoFrom_sysFS() From da94bed99eace463fe55485f9b154406eafd8e13 Mon Sep 17 00:00:00 2001 From: add-uos <164976197+add-uos@users.noreply.github.com> Date: Tue, 20 May 2025 14:26:53 +0800 Subject: [PATCH 37/69] fix: filter the invalid power device (#461) filter the invalid power device Log: filter the invalid power device Task: https://pms.uniontech.com/task-view-376787.html --- deepin-devicemanager/src/DeviceManager/DevicePower.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/deepin-devicemanager/src/DeviceManager/DevicePower.cpp b/deepin-devicemanager/src/DeviceManager/DevicePower.cpp index 2146f2e96..09e572d4a 100644 --- a/deepin-devicemanager/src/DeviceManager/DevicePower.cpp +++ b/deepin-devicemanager/src/DeviceManager/DevicePower.cpp @@ -66,7 +66,9 @@ TomlFixMethod DevicePower::setInfoFromTomlOneByOne(const QMap bool DevicePower::setInfoFromUpower(const QMap &mapInfo) { // 设置upower中获取的信息 - if (mapInfo["Device"].contains("line_power", Qt::CaseInsensitive)) { + if (mapInfo["Device"].contains("line_power", Qt::CaseInsensitive) || + mapInfo["state"].contains("empty", Qt::CaseInsensitive) || + mapInfo["state"].contains("unknown", Qt::CaseInsensitive)) { return false; } From 1977ed4804ba94a7eb0141d8d8fc6a46e7e40d4d Mon Sep 17 00:00:00 2001 From: add-uos <164976197+add-uos@users.noreply.github.com> Date: Wed, 21 May 2025 10:30:42 +0800 Subject: [PATCH 38/69] fix: the invalded device show incorrect (#462) fix the invalded device show incorrect Log: fix the invalded device show incorrect Bug: https://pms.uniontech.com/bug-view-256787.html Change-Id: I57c51ef8462b11a369a9f0276f039552a9ea2825 --- deepin-devicemanager/src/DeviceManager/DeviceManager.cpp | 5 ----- 1 file changed, 5 deletions(-) diff --git a/deepin-devicemanager/src/DeviceManager/DeviceManager.cpp b/deepin-devicemanager/src/DeviceManager/DeviceManager.cpp index 376af363a..3bc4c2775 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceManager.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceManager.cpp @@ -655,11 +655,6 @@ void DeviceManager::tomlDeviceSet(DeviceType deviceType) DeviceBaseInfo *newDevice = createDevice(deviceType); tomlDeviceMapSet(deviceType, newDevice, tomlMapLst[j]); tomlDeviceAdd(deviceType, newDevice); //加 - } else if ((deviceType != DT_Bios) && (deviceType != DT_Computer) && !fixSameOne) { - fixSameOne = true; //标记为该项信息有用过 ,则不再增加了 - DeviceBaseInfo *device = createDevice(deviceType); - tomlDeviceMapSet(deviceType, device, tomlMapLst[j]); - tomlDeviceAdd(deviceType, device); //不存在 就加 } } //end of for (int j = 0;... } From 0d1d1c731da4f7b0e3d0145f88a2bbe6bae3f8be Mon Sep 17 00:00:00 2001 From: gongheng Date: Tue, 27 May 2025 10:26:52 +0800 Subject: [PATCH 39/69] Fix: the monitor device incorrect order (#463) -- fix the monitor device incorrect order Log: fix issue Bug: https://pms.uniontech.com/bug-view-317457.html --- deepin-devicemanager/src/Tool/ThreadExecXrandr.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/deepin-devicemanager/src/Tool/ThreadExecXrandr.cpp b/deepin-devicemanager/src/Tool/ThreadExecXrandr.cpp index 03194c6d4..1a1623ac5 100644 --- a/deepin-devicemanager/src/Tool/ThreadExecXrandr.cpp +++ b/deepin-devicemanager/src/Tool/ThreadExecXrandr.cpp @@ -117,6 +117,10 @@ void ThreadExecXrandr::loadXrandrVerboseInfo(QList> &lstM // 新的显示屏 QMap newMap; newMap.insert("mainInfo", (*it).trimmed()); + auto mainInfoList = (*it).trimmed().split(" "); + if (mainInfoList.size() > 0) { + newMap.insert("port", mainInfoList.at(0)); + } lstMap.append(newMap); continue; } @@ -231,9 +235,12 @@ void ThreadExecXrandr::getMonitorInfoFromXrandrVerbose() { QList> lstMap; loadXrandrVerboseInfo(lstMap, "xrandr --verbose"); - if (Common::specialComType == Common::SpecialComputerType::NormalCom) { - std::reverse(lstMap.begin(), lstMap.end()); - } + std::sort(lstMap.begin(), lstMap.end(), [](const QMap &monintor1, const QMap &monintor2) { + if (monintor1.contains("port") && monintor2.contains("port")) + return monintor1.value("port") < monintor2.value("port"); + else + return false; + }); QList >::const_iterator it = lstMap.begin(); for (; it != lstMap.end(); ++it) { if ((*it).size() < 1) From 07bb6c90ccebb7c12471d935587964cc73aaffe7 Mon Sep 17 00:00:00 2001 From: zhanghongyuan Date: Thu, 29 May 2025 10:42:36 +0800 Subject: [PATCH 40/69] fix: modify the temperature of battery. fix the temperature of battery. Log: fix the temperature of battery. Bug: https://pms.uniontech.com/task-view-377193.html --- deepin-devicemanager/src/DeviceManager/DevicePower.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deepin-devicemanager/src/DeviceManager/DevicePower.cpp b/deepin-devicemanager/src/DeviceManager/DevicePower.cpp index 09e572d4a..d3e3ce090 100644 --- a/deepin-devicemanager/src/DeviceManager/DevicePower.cpp +++ b/deepin-devicemanager/src/DeviceManager/DevicePower.cpp @@ -194,7 +194,7 @@ void DevicePower::loadBaseDeviceInfo() addBaseDeviceInfo(("SBDS Serial Number"), m_SBDSSerialNumber); addBaseDeviceInfo(("SBDS Manufacture Date"), m_SBDSManufactureDate); addBaseDeviceInfo(("SBDS Chemistry"), m_SBDSChemistry); - addBaseDeviceInfo(("Temperature"), m_Temp); + addBaseDeviceInfo(("Temperature"), m_Temp.replace("degrees C", "℃", Qt::CaseInsensitive)); } void DevicePower::loadOtherDeviceInfo() From 73f65c2acaa8474901a214a2258690b77ff3bbf2 Mon Sep 17 00:00:00 2001 From: zhanghongyuan Date: Thu, 29 May 2025 11:10:21 +0800 Subject: [PATCH 41/69] fix: the cpu model in special machine. fix the cpu model. Log: fix the cpu model. Bug: https://pms.uniontech.com/task-view-377187.html --- deepin-devicemanager/src/DeviceManager/DeviceCpu.cpp | 6 ++++++ deepin-devicemanager/src/DeviceManager/DeviceCpu.h | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/deepin-devicemanager/src/DeviceManager/DeviceCpu.cpp b/deepin-devicemanager/src/DeviceManager/DeviceCpu.cpp index be8846aa9..574b83480 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceCpu.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceCpu.cpp @@ -251,6 +251,12 @@ void DeviceCpu::setInfoFromDmidecode(const QMap &mapInfo) setAttribute(mapInfo, "product", m_Name); } + if (Common::specialComType > 0) { + if (mapInfo.contains("Version")) { + setAttribute(mapInfo, "Version", m_Name); + } + } + // 获取设备基本信息 setAttribute(mapInfo, "Manufacturer", m_Vendor); setAttribute(mapInfo, "Max Speed", m_Frequency, false); diff --git a/deepin-devicemanager/src/DeviceManager/DeviceCpu.h b/deepin-devicemanager/src/DeviceManager/DeviceCpu.h index 0670fb6bd..ea132ba88 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceCpu.h +++ b/deepin-devicemanager/src/DeviceManager/DeviceCpu.h @@ -6,7 +6,7 @@ #ifndef DEVICECPU_H #define DEVICECPU_H #include "DeviceInfo.h" - +#include "commonfunction.h" /** * @brief The DeviceCpu class * 用来描述CPU的类 From e675774bd2da895682b067afadf188ba49323b9d Mon Sep 17 00:00:00 2001 From: zhanghongyuan Date: Thu, 29 May 2025 13:13:31 +0800 Subject: [PATCH 42/69] fix: remove useless info. remove useless info. Log: remove useless info. Task: https://pms.uniontech.com/task-view-377197.html Change-Id: I38069249ec2ad433e5401a921347d36ae06320c2 --- deepin-devicemanager/src/DeviceManager/DeviceBios.cpp | 4 ++-- deepin-devicemanager/src/DeviceManager/DeviceCpu.cpp | 6 +++--- deepin-devicemanager/src/DeviceManager/DeviceMemory.cpp | 2 +- deepin-devicemanager/src/DeviceManager/DevicePower.cpp | 6 +++--- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/deepin-devicemanager/src/DeviceManager/DeviceBios.cpp b/deepin-devicemanager/src/DeviceManager/DeviceBios.cpp index 26ce6a7e1..5b74f1a34 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceBios.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceBios.cpp @@ -186,9 +186,9 @@ void DeviceBios::initFilterKey() addFilterKey("Asset Tag"); addFilterKey("Features"); addFilterKey("Location In Chassis"); - addFilterKey("Chassis Handle"); +// addFilterKey("Chassis Handle"); addFilterKey("Type"); - addFilterKey("Contained Object Handles"); +// addFilterKey("Contained Object Handles"); addFilterKey("Product Name"); addFilterKey("Serial Number"); diff --git a/deepin-devicemanager/src/DeviceManager/DeviceCpu.cpp b/deepin-devicemanager/src/DeviceManager/DeviceCpu.cpp index 574b83480..8c2a23353 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceCpu.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceCpu.cpp @@ -66,12 +66,12 @@ void DeviceCpu::loadBaseDeviceInfo() // 添加基本信息 addBaseDeviceInfo(("Name"), m_Name); addBaseDeviceInfo(("Vendor"), m_Vendor); - addBaseDeviceInfo(("CPU ID"), m_PhysicalID); - addBaseDeviceInfo(("Core ID"), m_CoreID); +// addBaseDeviceInfo(("CPU ID"), m_PhysicalID); +// addBaseDeviceInfo(("Core ID"), m_CoreID); addBaseDeviceInfo(("Threads"), m_ThreadNum); if (!m_FrequencyIsCur) addBaseDeviceInfo(("Max Frequency"), m_MaxFrequency); - addBaseDeviceInfo(("BogoMIPS"), m_BogoMIPS); +// addBaseDeviceInfo(("BogoMIPS"), m_BogoMIPS); addBaseDeviceInfo(("Architecture"), m_Architecture); addBaseDeviceInfo(("CPU Family"), m_Familly); addBaseDeviceInfo(("Model"), m_Model); diff --git a/deepin-devicemanager/src/DeviceManager/DeviceMemory.cpp b/deepin-devicemanager/src/DeviceManager/DeviceMemory.cpp index 9df96b9ee..0050e56a1 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceMemory.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceMemory.cpp @@ -106,7 +106,7 @@ bool DeviceMemory::setInfoFromDmidecode(const QMap &mapInfo) void DeviceMemory::initFilterKey() { // 初始化可显示属性 - addFilterKey("Array Handle"); // 数组程序-2 +// addFilterKey("Array Handle"); // 数组程序-2 addFilterKey("Error Information Handle"); //错误信息程序-2 addFilterKey("Form Factor"); // 尺寸型号-2 addFilterKey("Set"); // 设置-2 diff --git a/deepin-devicemanager/src/DeviceManager/DevicePower.cpp b/deepin-devicemanager/src/DeviceManager/DevicePower.cpp index d3e3ce090..81fc412ef 100644 --- a/deepin-devicemanager/src/DeviceManager/DevicePower.cpp +++ b/deepin-devicemanager/src/DeviceManager/DevicePower.cpp @@ -146,9 +146,9 @@ const QString DevicePower::getOverviewInfo() void DevicePower::initFilterKey() { // 初始化可显示属性 - addFilterKey("native-path"); +// addFilterKey("native-path"); addFilterKey("power supply"); - addFilterKey("updated"); +// addFilterKey("updated"); addFilterKey("has history"); addFilterKey("has statistics"); addFilterKey("rechargeable"); @@ -167,7 +167,7 @@ void DevicePower::initFilterKey() addFilterKey("percentage"); // addFilterKey("temperature")); // 温度已经常规显示-2 addFilterKey("technology"); - addFilterKey("icon-name"); +// addFilterKey("icon-name"); addFilterKey("online"); addFilterKey("daemon-version"); addFilterKey("on-battery"); From af466052f3224799d6c293064e604d1f9365803b Mon Sep 17 00:00:00 2001 From: zhanghongyuan Date: Fri, 30 May 2025 09:31:04 +0800 Subject: [PATCH 43/69] fix: adjust the storage display order. adjust the storage display order. Log: adjust the storage display order. Task: https://pms.uniontech.com/task-view-377189.html Change-Id: Id1d49719127fb01e61e05ec7cdd2743823068b54 --- .../src/DeviceManager/DeviceManager.cpp | 49 +++++++++++++++++++ .../src/DeviceManager/DeviceManager.h | 5 ++ .../src/DeviceManager/DeviceStorage.cpp | 26 ++++++---- .../src/DeviceManager/DeviceStorage.h | 4 ++ .../src/GenerateDevice/DeviceGenerator.cpp | 2 + 5 files changed, 76 insertions(+), 10 deletions(-) diff --git a/deepin-devicemanager/src/DeviceManager/DeviceManager.cpp b/deepin-devicemanager/src/DeviceManager/DeviceManager.cpp index 3bc4c2775..98cde0c52 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceManager.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceManager.cpp @@ -913,6 +913,55 @@ void DeviceManager::checkDiskSize() } } +void DeviceManager::orderDiskByType() +{ + // 自定义排序 + auto compareDevices = [](DeviceBaseInfo* baseInfo1, DeviceBaseInfo* baseInfo2) { + DeviceStorage *storageA = dynamic_cast(baseInfo1); + DeviceStorage *storageB = dynamic_cast(baseInfo2); + + if (storageA == nullptr || storageB == nullptr) { + return false; + } + + // 判断是否为 USB 设备(包括 USB 接口的 SSD) + auto isUSBDevice = [](DeviceStorage *device) { + return device->interface().contains("USB") || + (device->interface().contains("USB") && device->mediaType().contains("SSD")); + }; + + // 1. 首先按照 UFS 优先 + if (storageA->interface().contains("UFS") && !storageB->interface().contains("UFS")) + return true; + if (!storageA->interface().contains("UFS") && storageB->interface().contains("UFS")) + return false; + + // 2. 然后按照 SSD、HDD 排序(排除 USB 接口的 SSD) + if (!isUSBDevice(storageA) && !isUSBDevice(storageB)) { + if (storageA->mediaType().contains("SSD") && !storageB->mediaType().contains("SSD")) + return true; + if (!storageA->mediaType().contains("SSD") && storageB->mediaType().contains("SSD")) + return false; + if (storageA->mediaType().contains("HDD") && !storageB->mediaType().contains("HDD")) + return true; + if (!storageA->mediaType().contains("HDD") && storageB->mediaType().contains("HDD")) + return false; + } + + // 3. 最后按照 USB 设备排序(包括 USB 接口的 SSD) + if (isUSBDevice(storageA) && !isUSBDevice(storageB)) + return false; // USB 设备排在后面 + if (!isUSBDevice(storageA) && isUSBDevice(storageB)) + return true; + + // 如果所有条件都相同,保持原有顺序 + return false; + }; + + // 使用自定义比较函数对列表进行排序 + std::sort(m_ListDeviceStorage.begin(), m_ListDeviceStorage.end(), compareDevices); +} + bool DeviceManager::setStorageDeviceMediaType(const QString &name, const QString &value) { // 设置存储设备介质类型 diff --git a/deepin-devicemanager/src/DeviceManager/DeviceManager.h b/deepin-devicemanager/src/DeviceManager/DeviceManager.h index 085422891..0d1e34b4e 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceManager.h +++ b/deepin-devicemanager/src/DeviceManager/DeviceManager.h @@ -213,6 +213,11 @@ class DeviceManager : public QObject */ virtual void checkDiskSize(); + /** + * @brief orderDiskByType:按照磁盘类型UFS、SSD、HDD、移动存储设备的顺序显示 + */ + virtual void orderDiskByType(); + // GPU设备相关 ************************************************************************************** /** * @brief addGpuDevice:添加显卡 diff --git a/deepin-devicemanager/src/DeviceManager/DeviceStorage.cpp b/deepin-devicemanager/src/DeviceManager/DeviceStorage.cpp index 0b7f1dbcf..27c3ec03c 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceStorage.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceStorage.cpp @@ -275,6 +275,16 @@ QString DeviceStorage::getSerialID(QString &strDeviceLink) return strSerialNumber; } +const QString &DeviceStorage::mediaType() const +{ + return m_MediaType; +} + +const QString &DeviceStorage::interface() const +{ + return m_Interface; +} + bool DeviceStorage::addInfoFromlshw(const QMap &mapInfo) { @@ -522,16 +532,12 @@ const QString DeviceStorage::getOverviewInfo() { QString overViewInfo = QString("%1 (%2)").arg(m_Name).arg(m_Size); - // 见内网gerrit项目 os-config 中机型的 specialComType , 示例配置文件位置如下: - // os-config/hardware/机型/etc/dsg/configs/overrides/org.deepin.devicemanager/org.deepin.devicemanager/4000-org.deepin.devicemanager.override.json - if (Common::specialComType == 5){ - if (m_Interface.contains("UFS", Qt::CaseInsensitive)) { - overViewInfo = QString("%1 %2").arg(m_Size).arg("UFS"); - } else if (m_Interface.contains("USB", Qt::CaseInsensitive)) { - overViewInfo = QString("%1 %2").arg(m_Size).arg("USB"); - } else { - overViewInfo = QString("%1 %2").arg(m_Size).arg(m_MediaType); - } + if (m_Interface.contains("UFS", Qt::CaseInsensitive)) { + overViewInfo = QString("%1 %2").arg(m_Size).arg("UFS"); + } else if (m_Interface.contains("USB", Qt::CaseInsensitive)) { + overViewInfo = QString("%1 %2").arg(m_Size).arg("USB"); + } else { + overViewInfo = QString("%1 %2").arg(m_Size).arg(m_MediaType); } return overViewInfo; diff --git a/deepin-devicemanager/src/DeviceManager/DeviceStorage.h b/deepin-devicemanager/src/DeviceManager/DeviceStorage.h index 6a4af6793..cf6212fa1 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceStorage.h +++ b/deepin-devicemanager/src/DeviceManager/DeviceStorage.h @@ -152,6 +152,10 @@ class DeviceStorage: public DeviceBaseInfo */ const QString getOverviewInfo() override; + QString interface() const; + + QString mediaType() const; + protected: /** diff --git a/deepin-devicemanager/src/GenerateDevice/DeviceGenerator.cpp b/deepin-devicemanager/src/GenerateDevice/DeviceGenerator.cpp index 859dfb0f5..e8a585386 100644 --- a/deepin-devicemanager/src/GenerateDevice/DeviceGenerator.cpp +++ b/deepin-devicemanager/src/GenerateDevice/DeviceGenerator.cpp @@ -231,6 +231,8 @@ void DeviceGenerator::generatorDiskDevice() getDiskInfoFromLsblk(); getDiskInfoFromSmartCtl(); DeviceManager::instance()->mergeDisk(); + + DeviceManager::instance()->orderDiskByType(); } void DeviceGenerator::generatorGpuDevice() From 8777b22483ba18fc11ab2f594c50329a3eb2fbc4 Mon Sep 17 00:00:00 2001 From: zhanghongyuan Date: Fri, 30 May 2025 15:50:43 +0800 Subject: [PATCH 44/69] fix: update device description to Universal Flash Storage Update device description to fixed value "Universal Flash Storage". Log: Update device description to fixed value "Universal Flash Storage" Bug: https://pms.uniontech.com/bug-view-315353.html Change-Id: Id04f0cf6666fd50496e95e8b631c8598e0c632cb --- deepin-devicemanager/src/DeviceManager/DeviceStorage.h | 4 ++-- deepin-devicemanager/src/GenerateDevice/HWGenerator.cpp | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/deepin-devicemanager/src/DeviceManager/DeviceStorage.h b/deepin-devicemanager/src/DeviceManager/DeviceStorage.h index cf6212fa1..2d89749bd 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceStorage.h +++ b/deepin-devicemanager/src/DeviceManager/DeviceStorage.h @@ -152,9 +152,9 @@ class DeviceStorage: public DeviceBaseInfo */ const QString getOverviewInfo() override; - QString interface() const; + const QString &interface() const; - QString mediaType() const; + const QString &mediaType() const; protected: diff --git a/deepin-devicemanager/src/GenerateDevice/HWGenerator.cpp b/deepin-devicemanager/src/GenerateDevice/HWGenerator.cpp index 33b4aee1a..088f72f72 100644 --- a/deepin-devicemanager/src/GenerateDevice/HWGenerator.cpp +++ b/deepin-devicemanager/src/GenerateDevice/HWGenerator.cpp @@ -278,8 +278,7 @@ void HWGenerator::generatorDiskDevice() tempMap["Vendor"] = "nouse"; if (name.contains("SDINFDO4-256G",Qt::CaseInsensitive)) tempMap["Name"] = "nouse"; - // 应HW的要求,将描述固定为 Universal Flash Storage - tempMap["Description"] = "Universal Flash Storage"; + if (Common::specialComType == 2) { tempMap["Interface"] = "UFS 3.1"; } From d6eac662813e2442cdc749a29cfb5d4c59d3f29c Mon Sep 17 00:00:00 2001 From: zhanghongyuan Date: Tue, 3 Jun 2025 15:53:14 +0800 Subject: [PATCH 45/69] fix: add the detail mode of screen size add the detail mode of screen size. extend the screen size. Log: add the detail mode of screen size Bug: https://pms.uniontech.com/bug-view-318561.html Change-Id: I1e51351fffe4b79e6db0050b1c5c9ced9828dd1d --- deepin-devicemanager/src/Tool/EDIDParser.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/deepin-devicemanager/src/Tool/EDIDParser.cpp b/deepin-devicemanager/src/Tool/EDIDParser.cpp index fa6cb7de7..8afa7eb1a 100644 --- a/deepin-devicemanager/src/Tool/EDIDParser.cpp +++ b/deepin-devicemanager/src/Tool/EDIDParser.cpp @@ -191,6 +191,20 @@ void EDIDParser::parseScreenSize() m_Height = height16; } + QString s66 = getBytes(4, m_LittleEndianMode ? 2 : 3), + s67 = getBytes(4, m_LittleEndianMode ? 3 : 2), + s68 = getBytes(4, m_LittleEndianMode ? 4 : 5); + + if (!s66.isEmpty() && !s67.isEmpty() && !s68.isEmpty()) { + int width_mm = hexToDec(s66).toInt() + ((hexToDec(s68).toInt() & 0xF0) << 4); + int height_mm = hexToDec(s67).toInt() + ((hexToDec(s68).toInt() & 0x0F) << 8); + + if (width_mm > 0 && height_mm > 0) { + m_Width = width_mm; + m_Height = height_mm; + } + } + double inch = sqrt((m_Width / 2.54) * (m_Width / 2.54) + (m_Height / 2.54) * (m_Height / 2.54))/10; m_ScreenSize = QString("%1 %2(%3mm×%4mm)").arg(QString::number(inch, '0', 1)).arg(QObject::tr("inch")).arg(m_Width).arg(m_Height); } From e85b4703ca3baf2e46793881f29936ffdf243f1d Mon Sep 17 00:00:00 2001 From: GongHeng Date: Fri, 30 May 2025 17:52:44 +0800 Subject: [PATCH 46/69] fix: [network] The wireless maybe connect. -- When disenable wireless, it maybe connneted. Log: fix issue Bug: https://pms.uniontech.com/bug-view-308649.html --- .../src/enablecontrol/enableutils.cpp | 70 ++++++++++++------- 1 file changed, 44 insertions(+), 26 deletions(-) diff --git a/deepin-devicemanager-server/deepin-devicecontrol/src/enablecontrol/enableutils.cpp b/deepin-devicemanager-server/deepin-devicecontrol/src/enablecontrol/enableutils.cpp index 33910d3c3..b2f051a01 100644 --- a/deepin-devicemanager-server/deepin-devicecontrol/src/enablecontrol/enableutils.cpp +++ b/deepin-devicemanager-server/deepin-devicecontrol/src/enablecontrol/enableutils.cpp @@ -10,6 +10,7 @@ #include #include #include +#include #include #include @@ -138,34 +139,51 @@ void EnableUtils::disableInDevice() bool EnableUtils::ioctlOperateNetworkLogicalName(const QString &logicalName, bool enable) { - // 1. 通过ioctl禁用 - int fd = socket(AF_INET, SOCK_STREAM, 0); - if (fd < 0) - return false; - struct ifreq ifr; - strncpy(ifr.ifr_name, logicalName.toStdString().c_str(),IFNAMSIZ); - ifr.ifr_name[IFNAMSIZ - 1] = '\0'; - short flag; - if (enable) { - flag = IFF_UP | IFF_PROMISC; - } else { - flag = ~(IFF_UP | IFF_PROMISC); - } - // 先获取标识 - if (ioctl(fd, SIOCGIFFLAGS, &ifr) < 0) { - close(fd); - return false; - } - // 获取后重新设置标识 - if (enable) { - ifr.ifr_ifru.ifru_flags |= flag; + if (logicalName.startsWith("wlan") || logicalName.startsWith("wlp")) { // Wireless LAN + QString cmd = QString("rfkill %1 $(rfkill list | grep -A 2 \"phy$(iw dev %2 info 2>/dev/null | awk '/wiphy/{print $2}')\" | awk 'NR==1{print $1}' | tr -d ':')") + .arg(enable ? "unblock" : "block") + .arg(logicalName); + int ret = system(cmd.toStdString().c_str()); + if (ret != 0) { + qCritical() << "Failed to block/unblock wifi: " << " error code: " << ret ; + } + cmd = QString("/sbin/ifconfig %1 %2").arg(logicalName).arg(enable ? "up" : "down"); + ret = system(cmd.toStdString().c_str()); + if (ret != 0) { + qCritical() << "Failed to up/down network: " << logicalName << enable << " error code: " << ret ; + return false; + } } else { - ifr.ifr_ifru.ifru_flags &= flag; - } + // 1. 通过ioctl禁用 + int fd = socket(AF_INET, SOCK_STREAM, 0); + if (fd < 0) + return false; + + struct ifreq ifr; + strncpy(ifr.ifr_name, logicalName.toStdString().c_str(),IFNAMSIZ); + ifr.ifr_name[IFNAMSIZ - 1] = '\0'; + short flag; + if (enable) { + flag = IFF_UP | IFF_PROMISC; + } else { + flag = ~(IFF_UP | IFF_PROMISC); + } + // 先获取标识 + if (ioctl(fd, SIOCGIFFLAGS, &ifr) < 0) { + close(fd); + return false; + } + // 获取后重新设置标识 + if (enable) { + ifr.ifr_ifru.ifru_flags |= flag; + } else { + ifr.ifr_ifru.ifru_flags &= flag; + } - if (ioctl(fd, SIOCSIFFLAGS, &ifr) < 0) { - close(fd); - return false; + if (ioctl(fd, SIOCSIFFLAGS, &ifr) < 0) { + close(fd); + return false; + } } return true; } From 1ba0d2a7493071e51dd6b2af2428dd13680eb643 Mon Sep 17 00:00:00 2001 From: zhanghongyuan Date: Wed, 16 Apr 2025 16:31:27 +0800 Subject: [PATCH 47/69] fix: fix wakeup ps/2 mouse fix wakeup ps/2 mouse Log: fix wakeup ps/2 mouse. Bug: https://pms.uniontech.com/bug-view-313055.html Change-Id: I84480ecaec50faecd8f841c6f22ccdbee369b294 --- .../src/DeviceManager/DeviceInput.cpp | 12 +++++++++++- .../src/DeviceManager/DeviceInput.h | 5 ++++- deepin-devicemanager/src/Page/PageMultiInfo.cpp | 4 ++++ deepin-devicemanager/src/Page/PageSingleInfo.cpp | 5 ++++- deepin-devicemanager/src/Widget/TableWidget.cpp | 16 ++++++++++++---- 5 files changed, 35 insertions(+), 7 deletions(-) diff --git a/deepin-devicemanager/src/DeviceManager/DeviceInput.cpp b/deepin-devicemanager/src/DeviceManager/DeviceInput.cpp index fccc4ce66..3c04e15b3 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceInput.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceInput.cpp @@ -261,6 +261,16 @@ QString DeviceInput::eventStrFromDeviceFiles(const QString &dfs) return ""; } +QString DeviceInput::getBusInfo() const +{ + return m_SysPath; +} + +QString DeviceInput::getInterface() const +{ + return m_Interface; +} + const QString &DeviceInput::name() const { return m_Name; @@ -373,7 +383,7 @@ bool DeviceInput::isWakeupMachine() } QString info = file.readAll(); - if (m_Name.contains("PS/2")) { + if (m_Name.contains("PS/2") || m_Interface.contains("PS/2")) { // QStringList lines = info.split("\n"); // for (QString line : lines) { // if (line.startsWith("PS2M" && line.contains("disabled"))) { diff --git a/deepin-devicemanager/src/DeviceManager/DeviceInput.h b/deepin-devicemanager/src/DeviceManager/DeviceInput.h index 2f11d2e74..2320df7c0 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceInput.h +++ b/deepin-devicemanager/src/DeviceManager/DeviceInput.h @@ -119,6 +119,10 @@ class DeviceInput : public DeviceBaseInfo */ bool bluetoothIsConnected(); + QString getBusInfo() const; + + QString getInterface() const; + protected: /** * @brief initFilterKey:初始化可现实的可显示的属性,m_FilterKey @@ -181,7 +185,6 @@ class DeviceInput : public DeviceBaseInfo bool m_wakeupChanged = true; // &lst, QListcanWakeupMachine() ? "true" : "false"); menuControl.append(input->wakeupPath()); + if (info->name().contains("PS/2")) { + menuControl.append(input->getBusInfo()); + menuControl.append(input->name()); + } } DeviceNetwork *network = dynamic_cast(info); diff --git a/deepin-devicemanager/src/Page/PageSingleInfo.cpp b/deepin-devicemanager/src/Page/PageSingleInfo.cpp index 59511151b..bd4b53c10 100644 --- a/deepin-devicemanager/src/Page/PageSingleInfo.cpp +++ b/deepin-devicemanager/src/Page/PageSingleInfo.cpp @@ -352,7 +352,10 @@ void PageSingleInfo::slotWakeupMachine() // 键盘鼠标唤醒机器 DeviceInput *input = qobject_cast(mp_Device); if (input && !input->wakeupID().isEmpty() && !input->sysPath().isEmpty()) { - DBusWakeupInterface::getInstance()->setWakeupMachine(input->wakeupID(), input->sysPath(), mp_WakeupMachine->isChecked(), input->name()); + DBusWakeupInterface::getInstance()->setWakeupMachine(input->wakeupID(), + input->sysPath(), + mp_WakeupMachine->isChecked(), + input->getInterface()); } // 网卡的远程唤醒 diff --git a/deepin-devicemanager/src/Widget/TableWidget.cpp b/deepin-devicemanager/src/Widget/TableWidget.cpp index 33043fdb5..c9dd8a628 100644 --- a/deepin-devicemanager/src/Widget/TableWidget.cpp +++ b/deepin-devicemanager/src/Widget/TableWidget.cpp @@ -280,10 +280,18 @@ void TableWidget::slotShowMenu(const QPoint &point) bool isWakeup = false; if(file.open(QIODevice::ReadOnly)){ QString info = file.readAll(); - if(info.contains("disabled")) - isWakeup = false; - else - isWakeup = true; + if (wakeupPath.contains("/proc/acpi/wakeup")) { + bool wakedUp = DBusWakeupInterface::getInstance()->isInputWakeupMachine(item->data(Qt::UserRole+4).toString(), + item->data(Qt::UserRole+5).toString()); + isWakeup = wakedUp; + } else { + if(info.contains("disabled")) { + isWakeup = false; + } + else { + isWakeup = true; + } + } } mp_WakeupMachine->setChecked(isWakeup); }else{ From 7f7dc0150cd41b79aab3c1ff692b878e7cfa549f Mon Sep 17 00:00:00 2001 From: zhanghongyuan Date: Thu, 19 Jun 2025 10:04:16 +0800 Subject: [PATCH 48/69] fix: format the overview of memory display format the overview of memory display Log: format the overview of memory display Bug: https://pms.uniontech.com/bug-view-320787.html --- deepin-devicemanager/src/DeviceManager/DeviceMemory.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) mode change 100644 => 100755 deepin-devicemanager/src/DeviceManager/DeviceMemory.cpp diff --git a/deepin-devicemanager/src/DeviceManager/DeviceMemory.cpp b/deepin-devicemanager/src/DeviceManager/DeviceMemory.cpp old mode 100644 new mode 100755 index 0050e56a1..01385cbe3 --- a/deepin-devicemanager/src/DeviceManager/DeviceMemory.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceMemory.cpp @@ -214,11 +214,13 @@ const QString DeviceMemory::getOverviewInfo() QString nameStr = m_Name != "" ? m_Name : m_Vendor; if (nameStr == "--") nameStr.clear(); - ov += QString("%1(%2 %3 %4)") \ + ov += QString("%1(%2%3 %4)") \ .arg(m_Size) \ - .arg(nameStr) \ + .arg(nameStr + (nameStr.isEmpty() ? "" : " ")) \ .arg(m_Type) \ .arg(m_Speed); + ov = ov.trimmed(); + return ov; } From c788e3c94e0c1f16874940382c83f6a269e24931 Mon Sep 17 00:00:00 2001 From: gongheng Date: Wed, 9 Jul 2025 11:10:02 +0800 Subject: [PATCH 49/69] fix: [GPU] The max resolution and min resolution show error. -- Show 'x' not show 'X'. Log: fix issue Bug: https://pms.uniontech.com/bug-view-323421.html --- deepin-devicemanager/src/Tool/ThreadExecXrandr.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/deepin-devicemanager/src/Tool/ThreadExecXrandr.cpp b/deepin-devicemanager/src/Tool/ThreadExecXrandr.cpp index 1a1623ac5..2550858ed 100644 --- a/deepin-devicemanager/src/Tool/ThreadExecXrandr.cpp +++ b/deepin-devicemanager/src/Tool/ThreadExecXrandr.cpp @@ -337,8 +337,8 @@ void ThreadExecXrandr::getResolutionFromDBus(QMap &lstMap) } if (maxResolutionWidth != -1) { - lstMap.insert("maxResolution", QString("%1×%2").arg(maxResolutionWidth).arg(maxResolutionHeight)); - lstMap.insert("minResolution", QString("%1×%2").arg(minResolutionWidth).arg(minResolutionHeight)); + lstMap.insert("maxResolution", QString("%1 x %2").arg(maxResolutionWidth).arg(maxResolutionHeight)); + lstMap.insert("minResolution", QString("%1 x %2").arg(minResolutionWidth).arg(minResolutionHeight)); } } From a9de646f84e6bebb97f3d958bb885bc4ef52dfc1 Mon Sep 17 00:00:00 2001 From: zhanghongyuan Date: Thu, 10 Jul 2025 19:20:39 +0800 Subject: [PATCH 50/69] feat: Update display size for specific device models Corrected firmware errors in EDID files by customizing all screen sizes to the actual 14-inch measurements. Log: Update display size specifications in EDID Task: https://pms.uniontech.com/task-view-378963.html Change-Id: Icccb3d31514c17f5f550bd2262e0e7a429c3dc85 --- deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp | 8 ++++---- deepin-devicemanager/src/Tool/EDIDParser.cpp | 6 +++++- deepin-devicemanager/src/Tool/EDIDParser.h | 2 +- deepin-devicemanager/src/Tool/ThreadExecXrandr.cpp | 6 +++--- 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp b/deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp index 3a50f0d44..fe0e76b4d 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp @@ -258,7 +258,7 @@ const QString DeviceMonitor::getOverviewInfo() QString ov; ov = QString("%1(%2)").arg(m_Name).arg(m_ScreenSize); - if (Common::specialComType == 6) { + if (Common::specialComType == 6 || Common::specialComType == 7) { ov = QString("(%1)").arg(m_ScreenSize); } else { ov = QString("%1(%2)").arg(m_Name).arg(m_ScreenSize); @@ -275,7 +275,7 @@ void DeviceMonitor::initFilterKey() void DeviceMonitor::loadBaseDeviceInfo() { // 添加基本信息 - if (Common::specialComType != 6 && Common::specialComType != 5) { + if (Common::specialComType != 6 && Common::specialComType != 5 && Common::specialComType != 7) { addBaseDeviceInfo(("Name"), m_Name); addBaseDeviceInfo(("Vendor"), m_Vendor); addBaseDeviceInfo(("Type"), m_Model); @@ -349,10 +349,10 @@ bool DeviceMonitor::setMainInfoFromXrandr(const QString &info, const QString &ra curRate = QString::number(ceil(curRate.left(pos).toDouble())) + curRate.right(curRate.size() - pos); } } - if (Common::specialComType == 1 || Common::specialComType == 5 || Common::specialComType == 6) { + if (Common::specialComType == 1 || Common::specialComType == 5 || Common::specialComType == 6 || Common::specialComType == 7) { m_RefreshRate = QString("%1").arg(curRate); } - if (Common::specialComType == 5 || Common::specialComType == 6) { + if (Common::specialComType == 5 || Common::specialComType == 6 || Common::specialComType == 7) { m_CurrentResolution = QString("%1").arg(reScreenSize.cap(1)).replace("x", "×", Qt::CaseInsensitive); } else { m_CurrentResolution = QString("%1 @%2").arg(reScreenSize.cap(1)).arg(curRate).replace("x", "×", Qt::CaseInsensitive); diff --git a/deepin-devicemanager/src/Tool/EDIDParser.cpp b/deepin-devicemanager/src/Tool/EDIDParser.cpp index 8afa7eb1a..082adbaa8 100644 --- a/deepin-devicemanager/src/Tool/EDIDParser.cpp +++ b/deepin-devicemanager/src/Tool/EDIDParser.cpp @@ -205,8 +205,12 @@ void EDIDParser::parseScreenSize() } } + if (Common::specialComType == 7){ // sepcial task:378963 + m_Width = 296; + m_Height = 197; + } double inch = sqrt((m_Width / 2.54) * (m_Width / 2.54) + (m_Height / 2.54) * (m_Height / 2.54))/10; - m_ScreenSize = QString("%1 %2(%3mm×%4mm)").arg(QString::number(inch, '0', 1)).arg(QObject::tr("inch")).arg(m_Width).arg(m_Height); + m_ScreenSize = QString("%1 %2(%3mm×%4mm)").arg(QString::number(inch, '0', Common::specialComType == 7 ? 0 : 1)).arg(QObject::tr("inch")).arg(m_Width).arg(m_Height); } QString EDIDParser::binToDec(QString strBin) //二进制转十进制 diff --git a/deepin-devicemanager/src/Tool/EDIDParser.h b/deepin-devicemanager/src/Tool/EDIDParser.h index cdee3cee3..0f7118f55 100644 --- a/deepin-devicemanager/src/Tool/EDIDParser.h +++ b/deepin-devicemanager/src/Tool/EDIDParser.h @@ -8,7 +8,7 @@ #include #include #include - +#include /** * @brief The EDIDParser class * 用于解析edid的类 diff --git a/deepin-devicemanager/src/Tool/ThreadExecXrandr.cpp b/deepin-devicemanager/src/Tool/ThreadExecXrandr.cpp index 2550858ed..54d75f22a 100644 --- a/deepin-devicemanager/src/Tool/ThreadExecXrandr.cpp +++ b/deepin-devicemanager/src/Tool/ThreadExecXrandr.cpp @@ -78,7 +78,7 @@ void ThreadExecXrandr::loadXrandrInfo(QList> &lstMap, con QRegExp re(".*([0-9]{1,5}\\sx\\s[0-9]{1,5}).*([0-9]{1,5}\\sx\\s[0-9]{1,5}).*([0-9]{1,5}\\sx\\s[0-9]{1,5}).*"); if (re.exactMatch(line)) { lstMap[lstMap.count() - 1].insert("minResolution", re.cap(1)); - lstMap[lstMap.count() - 1].insert("curResolution", re.cap(2)); + lstMap[lstMap.count() - 1].insert("curResolution", re.cap(2).replace("x", "×", Qt::CaseInsensitive)); lstMap[lstMap.count() - 1].insert("maxResolution", re.cap(3)); } continue; @@ -337,8 +337,8 @@ void ThreadExecXrandr::getResolutionFromDBus(QMap &lstMap) } if (maxResolutionWidth != -1) { - lstMap.insert("maxResolution", QString("%1 x %2").arg(maxResolutionWidth).arg(maxResolutionHeight)); - lstMap.insert("minResolution", QString("%1 x %2").arg(minResolutionWidth).arg(minResolutionHeight)); + lstMap.insert("maxResolution", QString("%1×%2").arg(maxResolutionWidth).arg(maxResolutionHeight)); + lstMap.insert("minResolution", QString("%1×%2").arg(minResolutionWidth).arg(minResolutionHeight)); } } From 2941cca20d736b4212dd8765efea1c772f826e61 Mon Sep 17 00:00:00 2001 From: gongheng Date: Tue, 15 Jul 2025 13:25:36 +0800 Subject: [PATCH 51/69] fix: [Stroage-interface] The interface show error. (#487) -- In the special platform, the stroage interface show error. Log: fix issuse Bug: https://pms.uniontech.com/bug-view-322565.html --- deepin-devicemanager/src/DeviceManager/DeviceStorage.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/deepin-devicemanager/src/DeviceManager/DeviceStorage.cpp b/deepin-devicemanager/src/DeviceManager/DeviceStorage.cpp index 27c3ec03c..2019a43c6 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceStorage.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceStorage.cpp @@ -212,11 +212,13 @@ bool DeviceStorage::setHwinfoInfo(const QMap &mapInfo) QString Path = "/sys/block/" + logicalName + "/device/spec_version"; QFile file(Path); if (file.open(QIODevice::ReadOnly)) { - QString output2 = file.readAll(); - if (output2.contains("310", Qt::CaseInsensitive)) { + QString output = file.readAll(); + if (output.contains("310", Qt::CaseInsensitive)) { m_Interface = "UFS 3.1"; - } else if (output2.contains("300", Qt::CaseInsensitive)) { + } else if (output.contains("300", Qt::CaseInsensitive)) { m_Interface = "UFS 3.0"; + } else if (output.contains("400", Qt::CaseInsensitive)) { + m_Interface = "UFS 4.0"; } file.close(); } From 2608aaea5c50d17daf10f75fecbfbe9bf07296d0 Mon Sep 17 00:00:00 2001 From: zhanghongyuan Date: Wed, 16 Jul 2025 10:42:11 +0800 Subject: [PATCH 52/69] fix: Format graphics card resolution display Fixed the formatted resolution display of graphics cards by removing redundant spaces. Log: Improve resolution display formatting Bug: https://pms.uniontech.com/bug-view-324363.html Change-Id: I9c2ee6868354bc2c55c45ffec42ba6a34f3e961d --- deepin-devicemanager/src/Tool/ThreadExecXrandr.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deepin-devicemanager/src/Tool/ThreadExecXrandr.cpp b/deepin-devicemanager/src/Tool/ThreadExecXrandr.cpp index 54d75f22a..a32d2aa8a 100644 --- a/deepin-devicemanager/src/Tool/ThreadExecXrandr.cpp +++ b/deepin-devicemanager/src/Tool/ThreadExecXrandr.cpp @@ -78,7 +78,7 @@ void ThreadExecXrandr::loadXrandrInfo(QList> &lstMap, con QRegExp re(".*([0-9]{1,5}\\sx\\s[0-9]{1,5}).*([0-9]{1,5}\\sx\\s[0-9]{1,5}).*([0-9]{1,5}\\sx\\s[0-9]{1,5}).*"); if (re.exactMatch(line)) { lstMap[lstMap.count() - 1].insert("minResolution", re.cap(1)); - lstMap[lstMap.count() - 1].insert("curResolution", re.cap(2).replace("x", "×", Qt::CaseInsensitive)); + lstMap[lstMap.count() - 1].insert("curResolution", re.cap(2).replace(" ", "").replace("x", "×", Qt::CaseInsensitive)); lstMap[lstMap.count() - 1].insert("maxResolution", re.cap(3)); } continue; From 350c0a63c89cde2b3bb8aa521e59fd9ec5ec47e7 Mon Sep 17 00:00:00 2001 From: gongheng Date: Tue, 22 Jul 2025 17:02:10 +0800 Subject: [PATCH 53/69] feat: [GPU] Add logic to show GPU info. -- In some special computer, the GPU info not show. -- Add logic to show GPU info. Log: add feature for GPU. Task: https://pms.uniontech.com/task-view-378987.html --- deepin-devicemanager-server/CMakeLists.txt | 1 + .../customgpuinfo/CMakeLists.txt | 24 ++++ .../customgpuinfo/main.cpp | 120 ++++++++++++++++++ .../src/loadinfo/deviceinterface.cpp | 29 +++++ .../src/loadinfo/deviceinterface.h | 2 + .../assets/org.deepin.devicemanager.json | 10 ++ .../src/DeviceManager/DeviceGpu.cpp | 9 ++ .../src/DeviceManager/DeviceGpu.h | 2 + .../src/GenerateDevice/CustomGenerator.cpp | 92 ++++++++++++++ .../src/GenerateDevice/CustomGenerator.h | 27 ++++ .../src/GenerateDevice/DBusInterface.cpp | 12 ++ .../src/GenerateDevice/DBusInterface.h | 2 + .../src/GenerateDevice/DeviceFactory.cpp | 3 + deepin-devicemanager/src/Tool/commontools.cpp | 57 +++++++++ deepin-devicemanager/src/Tool/commontools.h | 3 + deepin-devicemanager/src/commonfunction.cpp | 3 + deepin-devicemanager/src/commonfunction.h | 5 +- 17 files changed, 400 insertions(+), 1 deletion(-) create mode 100644 deepin-devicemanager-server/customgpuinfo/CMakeLists.txt create mode 100644 deepin-devicemanager-server/customgpuinfo/main.cpp create mode 100644 deepin-devicemanager/src/GenerateDevice/CustomGenerator.cpp create mode 100644 deepin-devicemanager/src/GenerateDevice/CustomGenerator.h diff --git a/deepin-devicemanager-server/CMakeLists.txt b/deepin-devicemanager-server/CMakeLists.txt index 242825003..c8b62421c 100644 --- a/deepin-devicemanager-server/CMakeLists.txt +++ b/deepin-devicemanager-server/CMakeLists.txt @@ -2,6 +2,7 @@ project(deepin-devicemanager-server C CXX) add_subdirectory(deepin-deviceinfo) add_subdirectory(deepin-devicecontrol) +add_subdirectory(customgpuinfo) #TEST-------------------------------------------------- if (CMAKE_COVERAGE_ARG STREQUAL "CMAKE_COVERAGE_ARG_ON") diff --git a/deepin-devicemanager-server/customgpuinfo/CMakeLists.txt b/deepin-devicemanager-server/customgpuinfo/CMakeLists.txt new file mode 100644 index 000000000..e9071dde6 --- /dev/null +++ b/deepin-devicemanager-server/customgpuinfo/CMakeLists.txt @@ -0,0 +1,24 @@ +cmake_minimum_required(VERSION 3.7) + +set(BIN_NAME "customgpuinfo") + +find_package(Qt5 COMPONENTS Core REQUIRED) + +file(GLOB_RECURSE SRC + "${CMAKE_CURRENT_SOURCE_DIR}/*.h" + "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp" +) + +add_executable(${BIN_NAME} + ${SRC} +) + +target_include_directories(${BIN_NAME} PUBLIC + Qt5::Core +) + +target_link_libraries(${BIN_NAME} PRIVATE + Qt5::Core +) + +install(TARGETS ${BIN_NAME} DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/deepin-devicemanager) diff --git a/deepin-devicemanager-server/customgpuinfo/main.cpp b/deepin-devicemanager-server/customgpuinfo/main.cpp new file mode 100644 index 000000000..ec961e915 --- /dev/null +++ b/deepin-devicemanager-server/customgpuinfo/main.cpp @@ -0,0 +1,120 @@ +// SPDX-FileCopyrightText: 2025 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +#include +#include +#include +#include +#include + +#include + +// 名称("Name") 厂商("Vendor") 型号("Model") 显存("Graphics Memory") + +constexpr char kName[] { "Name" }; +constexpr char kVendor[] { "Vendor" }; +constexpr char kModel[] { "Model" }; +constexpr char kGraphicsMemory[] { "Graphics Memory" }; + +bool getGpuBaseInfo(QMap &mapInfo) +{ + QProcess process; + QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); + process.setProcessEnvironment(env); + process.start("/usr/bin/glxinfo", QStringList() << "-B"); + if (!process.waitForFinished(3000)) { + qCritical() << "Error executing glxinfo:" << process.errorString(); + return false; + } + + QString output = QString::fromLocal8Bit(process.readAllStandardOutput()); + QStringList lines = output.split('\n'); + QRegularExpression regex("^([^:]+):\\s*(.+)$"); + for (const QString &line : lines) { + QRegularExpressionMatch match = regex.match(line); + if (match.hasMatch()) { + QString key = match.captured(1).trimmed(); + QString value = match.captured(2).trimmed(); + if (key == "OpenGL renderer string") { + mapInfo.insert(kName, value); + mapInfo.insert(kModel, value); + } else if (key == "OpenGL vendor string") { + mapInfo.insert(kVendor, value); + } + } + } + + return true; +} + +bool getGpuMemInfoForFTDTM(QMap &mapInfo) +{ + const QString filePath = "/sys/kernel/debug/gc/meminfo"; + QString totalValue; + bool foundTotal = false; + + QFile file(filePath); + if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { + qCritical() << "Error opening /sys/kernel/debug/gc/meminfo:" << file.errorString(); + return false; + } + + QString content = QString::fromUtf8(file.readAll()); + file.close(); + + if (content.isEmpty()) { + qCritical() << "Error: /sys/kernel/debug/gc/meminfo File is empty!"; + return false; + } + + QRegularExpression system0Regex(R"(POOL SYSTEM0:*(.*?)POOL VIRTUAL:)", + QRegularExpression::DotMatchesEverythingOption); + QRegularExpressionMatch system0Match = system0Regex.match(content); + + if (!system0Match.hasMatch()) { + qCritical() << "Error: Failed to find SYSTEM0 section"; + return false; + } + + QString system0Content = system0Match.captured(1); + QRegularExpression totalRegex(R"(Total\s*:\s*(\d+)\s+B)"); + QRegularExpressionMatch totalMatch = totalRegex.match(system0Content); + if (totalMatch.hasMatch()) { + totalValue = totalMatch.captured(1); + foundTotal = true; + } + + if (!foundTotal || totalValue.isEmpty()) { + qCritical() << "Error: Failed to find Total value in SYSTEM0 content"; + return false; + } + + bool ok; + quint64 memSize = totalValue.trimmed().toULong(&ok, 10); + if (ok && memSize >= 1048576) { + memSize /= 1048576; + auto curSize = memSize / 1024.0; + if (curSize >= 1) { + totalValue = QString::number(curSize) + "GB"; + } else { + totalValue = QString::number(memSize) + "MB"; + } + } + + mapInfo.insert(kGraphicsMemory, totalValue); + + return true; +} + +int main(int argc, char *argv[]) +{ + QMap mapInfo; + if (getGpuBaseInfo(mapInfo) && getGpuMemInfoForFTDTM(mapInfo)) { + for (auto it = mapInfo.begin(); it != mapInfo.end(); ++it) + std::cout << it.key().toStdString() << ": " << it.value().toStdString() << std::endl; + return 0; + } else { + return 1; + } +} diff --git a/deepin-devicemanager-server/deepin-deviceinfo/src/loadinfo/deviceinterface.cpp b/deepin-devicemanager-server/deepin-deviceinfo/src/loadinfo/deviceinterface.cpp index cb23d33b6..89d975ecf 100644 --- a/deepin-devicemanager-server/deepin-deviceinfo/src/loadinfo/deviceinterface.cpp +++ b/deepin-devicemanager-server/deepin-deviceinfo/src/loadinfo/deviceinterface.cpp @@ -8,6 +8,8 @@ #include #include +#include +#include #include using namespace PolkitQt1; @@ -56,3 +58,30 @@ void DeviceInterface::setMonitorDeviceFlag(bool flag) parentMainJob->setWorkingFlag(flag); } } + +QString DeviceInterface::getGpuInfoByCustom(const QString &cmd, const QStringList &arguments) +{ + static bool firstFlag = true; + static QString gpuinfo; + if (firstFlag) { + firstFlag = false; + + QProcess process; + QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); + if (arguments.size() > 1) { + env.insert("DISPLAY", arguments[0]); + env.insert("XAUTHORITY", arguments[1]); + } + process.setProcessEnvironment(env); + process.start(cmd, arguments); + if (!process.waitForFinished(4000)) { + qCritical() << QString("Error executing %1 :").arg(cmd) << process.errorString(); + return gpuinfo; + } + + if (process.exitCode() == 0) + gpuinfo = QString::fromLocal8Bit(process.readAllStandardOutput()); + } + + return gpuinfo; +} diff --git a/deepin-devicemanager-server/deepin-deviceinfo/src/loadinfo/deviceinterface.h b/deepin-devicemanager-server/deepin-deviceinfo/src/loadinfo/deviceinterface.h index f1ad9f158..01c656107 100644 --- a/deepin-devicemanager-server/deepin-deviceinfo/src/loadinfo/deviceinterface.h +++ b/deepin-devicemanager-server/deepin-deviceinfo/src/loadinfo/deviceinterface.h @@ -39,6 +39,8 @@ public slots: */ Q_SCRIPTABLE void setMonitorDeviceFlag(bool flag); + Q_SCRIPTABLE QString getGpuInfoByCustom(const QString &cmd, const QStringList &arguments); + private: bool getUserAuthorPasswd(); }; diff --git a/deepin-devicemanager/assets/org.deepin.devicemanager.json b/deepin-devicemanager/assets/org.deepin.devicemanager.json index 820f9142d..8f53b60a1 100644 --- a/deepin-devicemanager/assets/org.deepin.devicemanager.json +++ b/deepin-devicemanager/assets/org.deepin.devicemanager.json @@ -34,6 +34,16 @@ "description": "此配置项默认为无效的。如需让toml文件内容显示生效,请配置对应文件名。需保证操作者具备读取权限。", "permissions": "readwrite", "visibility": "private" + }, + "CommandToGetGPUInfo": { + "value": "", + "serial": 0, + "flags": ["global"], + "name": "Command to get GPU infomation", + "name[zh_CN]": "获取GPU信息的命令", + "description": "此配置项默认为空。如果specialComType==8,程序则启用此项配置。", + "permissions": "readwrite", + "visibility": "private" } } } diff --git a/deepin-devicemanager/src/DeviceManager/DeviceGpu.cpp b/deepin-devicemanager/src/DeviceManager/DeviceGpu.cpp index 84c320de1..e8b68fdbd 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceGpu.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceGpu.cpp @@ -284,6 +284,15 @@ void DeviceGpu::setGpuInfo(const QMap &mapInfo) getOtherMapInfo(mapInfo); } +// 名称(Name) 厂商(Vendor) 型号(Model) 显存(Graphics Memory) +void DeviceGpu::setGpuInfoByCustom(const QMap &mapInfo) +{ + setAttribute(mapInfo, "Name", m_Name); + setAttribute(mapInfo, "Vendor", m_Vendor); + setAttribute(mapInfo, "Model", m_Model); + setAttribute(mapInfo, "Graphics Memory", m_GraphicsMemory); +} + const QString &DeviceGpu::name() const { return m_Name; diff --git a/deepin-devicemanager/src/DeviceManager/DeviceGpu.h b/deepin-devicemanager/src/DeviceManager/DeviceGpu.h index d5d4e1f40..8a7b61118 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceGpu.h +++ b/deepin-devicemanager/src/DeviceManager/DeviceGpu.h @@ -56,6 +56,8 @@ class DeviceGpu: public DeviceBaseInfo */ void setGpuInfo(const QMap &mapInfo); + void setGpuInfoByCustom(const QMap &mapInfo); + /** * @brief name:获取名称属性值 * @return QString 名称属性值 diff --git a/deepin-devicemanager/src/GenerateDevice/CustomGenerator.cpp b/deepin-devicemanager/src/GenerateDevice/CustomGenerator.cpp new file mode 100644 index 000000000..046250a8b --- /dev/null +++ b/deepin-devicemanager/src/GenerateDevice/CustomGenerator.cpp @@ -0,0 +1,92 @@ +// SPDX-FileCopyrightText: 2025 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +#include "CustomGenerator.h" +#include "DeviceGpu.h" +#include "DBusInterface.h" +#include "commontools.h" + +#include +#include +#include +#include +#include + +CustomGenerator::CustomGenerator(QObject *parent) + : DeviceGenerator(parent) +{ +} + +void CustomGenerator::generatorGpuDevice() +{ + QString cmd = CommonTools::getGpuInfoCommandFromDConfig(); + if (cmd.isEmpty()) { + DeviceGenerator::generatorGpuDevice(); + return; + } + + QStringList arguments; + QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); + QString display = env.value("DISPLAY"); + QString xauthority = env.value("XAUTHORITY"); + if (display.isEmpty() || xauthority.isEmpty()) { + qWarning() << "DISPLAY or XAUTHORITY is not set!"; + } else { + arguments << display << xauthority; + } + + QString tmpGpuInfo; + DBusInterface::getInstance()->getGpuInfoByCustom(cmd, arguments, tmpGpuInfo); + if (tmpGpuInfo.isEmpty()) { + qCritical() << "Failed to get gpu info by commad " << cmd; + return; + } + + QList> gpuInfo; + QStringList mapBlocks = tmpGpuInfo.split("\n\n"); + for (const QString &block : mapBlocks) { + QMap infoMap; + QStringList lines = block.split("\n"); + for (const QString &line : lines) { + int colonIndex = line.indexOf(':'); + if (colonIndex != -1) { + QString key = line.left(colonIndex).trimmed(); + QString value = line.mid(colonIndex + 1).trimmed(); + infoMap.insert(key, value); + } + } + if (!infoMap.isEmpty()) + gpuInfo.push_back(infoMap); + } + + for(int i = 0; i < gpuInfo.count(); ++i) { + DeviceGpu *device = new DeviceGpu(); + device->setCanUninstall(false); + device->setForcedDisplay(true); + device->setGpuInfoByCustom(gpuInfo.at(i)); + DeviceManager::instance()->addGpuDevice(device); + } +} + +void CustomGenerator::generatorMonitorDevice() +{ + QString toDir = "/sys/class/drm"; + QDir toDir_(toDir); + + if (!toDir_.exists()) + return; + + QFileInfoList fileInfoList = toDir_.entryInfoList(QDir::NoFilter, QDir::Name); + foreach(QFileInfo fileInfo, fileInfoList) { + if (fileInfo.fileName() == "." || fileInfo.fileName() == ".." || !fileInfo.fileName().startsWith("card")) + continue; + + if (QFile::exists(fileInfo.filePath() + "/" + "edid")) { + QStringList allEDIDS_all; + allEDIDS_all.append(fileInfo.filePath() + "/" + "edid"); + QString interface = fileInfo.fileName().remove("card0-").remove("card1-").remove("card2-"); + CommonTools::parseEDID(allEDIDS_all, interface); + } + } +} diff --git a/deepin-devicemanager/src/GenerateDevice/CustomGenerator.h b/deepin-devicemanager/src/GenerateDevice/CustomGenerator.h new file mode 100644 index 000000000..9901d2ad4 --- /dev/null +++ b/deepin-devicemanager/src/GenerateDevice/CustomGenerator.h @@ -0,0 +1,27 @@ +// Copyright (C) 2025 Uniontech Software Technology Co.,Ltd. +// SPDX-FileCopyrightText: 2025 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +#ifndef CUSTOMGENERATOR_H +#define CUSTOMGENERATOR_H + +#include "DeviceGenerator.h" + +class CustomGenerator : public DeviceGenerator +{ +public: + CustomGenerator(QObject *parent = nullptr); + + /** + * @brief generatorGpuDevice:生成显卡信息 + */ + void generatorGpuDevice() override; + + /** + * @brief generatorMonitorDevice:生成显示设备信息 + */ + void generatorMonitorDevice() override; +}; + +#endif // CUSTOMGENERATOR_H diff --git a/deepin-devicemanager/src/GenerateDevice/DBusInterface.cpp b/deepin-devicemanager/src/GenerateDevice/DBusInterface.cpp index 59ba79bcb..f08eb45f0 100644 --- a/deepin-devicemanager/src/GenerateDevice/DBusInterface.cpp +++ b/deepin-devicemanager/src/GenerateDevice/DBusInterface.cpp @@ -46,6 +46,18 @@ void DBusInterface::refreshInfo() mp_Iface->asyncCall("refreshInfo"); } +bool DBusInterface::getGpuInfoByCustom(const QString &cmd, const QStringList &arguments, QString &gpuInfo) +{ + QDBusReply replyList = mp_Iface->call("getGpuInfoByCustom", cmd, arguments); + if (replyList.isValid()) { + gpuInfo = replyList.value(); + return true; + } else { + qCritical() << "Error: failed to call dbus to get gpu memery info! "; + return false; + } +} + void DBusInterface::init() { // 1. 连接到dbus diff --git a/deepin-devicemanager/src/GenerateDevice/DBusInterface.h b/deepin-devicemanager/src/GenerateDevice/DBusInterface.h index a154a3377..c6a01898c 100644 --- a/deepin-devicemanager/src/GenerateDevice/DBusInterface.h +++ b/deepin-devicemanager/src/GenerateDevice/DBusInterface.h @@ -47,6 +47,8 @@ class DBusInterface */ void refreshInfo(); + bool getGpuInfoByCustom(const QString &cmd, const QStringList &arguments, QString &gpuInfo); + protected: DBusInterface(); diff --git a/deepin-devicemanager/src/GenerateDevice/DeviceFactory.cpp b/deepin-devicemanager/src/GenerateDevice/DeviceFactory.cpp index 0a107937c..30102c9b9 100644 --- a/deepin-devicemanager/src/GenerateDevice/DeviceFactory.cpp +++ b/deepin-devicemanager/src/GenerateDevice/DeviceFactory.cpp @@ -8,6 +8,7 @@ #include "MipsGenerator.h" #include "ArmGenerator.h" #include "HWGenerator.h" +#include "CustomGenerator.h" #include "commonfunction.h" // Qt库文件 @@ -41,6 +42,8 @@ DeviceGenerator *DeviceFactory::getDeviceGenerator() generator = new HWGenerator(); else if (type == "PGUX") generator = new HWGenerator(); + else if (type == "CustomType") + generator = new CustomGenerator(); else generator = new HWGenerator(); } else diff --git a/deepin-devicemanager/src/Tool/commontools.cpp b/deepin-devicemanager/src/Tool/commontools.cpp index 8b29bea71..2cf89c6e7 100644 --- a/deepin-devicemanager/src/Tool/commontools.cpp +++ b/deepin-devicemanager/src/Tool/commontools.cpp @@ -4,6 +4,8 @@ #include "commontools.h" #include "DDLog.h" +#include "EDIDParser.h" +#include "DeviceMonitor.h" #include #include @@ -11,6 +13,8 @@ #include #include #include +#include +#include DWIDGET_USE_NAMESPACE using namespace DDLog; @@ -162,3 +166,56 @@ QString CommonTools::getBackupPath() { return "/usr/share/deepin-devicemanager/"; } + +void CommonTools::parseEDID(const QStringList &allEDIDS, const QString &input) +{ + for (auto edid:allEDIDS) { + QProcess process; + process.start(QString("hexdump %1").arg(edid)); + process.waitForFinished(-1); + + QString deviceInfo = process.readAllStandardOutput(); + if (deviceInfo.isEmpty()) + continue; + + QString edidStr; + QStringList lines = deviceInfo.split("\n"); + for (auto line:lines) { + QStringList words = line.trimmed().split(" "); + if (words.size() != 9) + continue; + + words.removeAt(0); + QString l = words.join(""); + l.append("\n"); + edidStr.append(l); + } + + lines = edidStr.split("\n"); + if (lines.size() > 3){ + EDIDParser edidParser; + QString errorMsg; + edidParser.setEdid(edidStr,errorMsg,"\n", false); + + QMap mapInfo; + mapInfo.insert("Vendor",edidParser.vendor()); + mapInfo.insert("Model",edidParser.model()); + //mapInfo.insert("Date",edidParser.releaseDate()); + mapInfo.insert("Size",edidParser.screenSize()); + mapInfo.insert("Display Input",input); + + DeviceMonitor *device = new DeviceMonitor(); + device->setInfoFromEdid(mapInfo); + DeviceManager::instance()->addMonitor(device); + } + } +} + +QString CommonTools::getGpuInfoCommandFromDConfig() +{ + QString cmd; + DConfig *dconfig = DConfig::create("org.deepin.devicemanager","org.deepin.devicemanager"); + if (dconfig && dconfig->isValid() && dconfig->keyList().contains("CommandToGetGPUInfo")) + cmd = dconfig->value("CommandToGetGPUInfo").toString(); + return cmd; +} diff --git a/deepin-devicemanager/src/Tool/commontools.h b/deepin-devicemanager/src/Tool/commontools.h index 6948c8f68..71b2bc890 100644 --- a/deepin-devicemanager/src/Tool/commontools.h +++ b/deepin-devicemanager/src/Tool/commontools.h @@ -78,6 +78,9 @@ class CommonTools : public QObject */ static QString getBackupPath(); + static void parseEDID(const QStringList &allEDIDS, const QString &input); + static QString getGpuInfoCommandFromDConfig(); + signals: public slots: diff --git a/deepin-devicemanager/src/commonfunction.cpp b/deepin-devicemanager/src/commonfunction.cpp index 40c94cbe6..116b1ada5 100644 --- a/deepin-devicemanager/src/commonfunction.cpp +++ b/deepin-devicemanager/src/commonfunction.cpp @@ -137,6 +137,9 @@ QString Common::checkBoardVendorFlag() case PGUX: boardVendorKey = "PGUX"; break; + case kCustomType: + boardVendorKey = "CustomType"; + break; default: boardVendorKey = "PGUW"; break; diff --git a/deepin-devicemanager/src/commonfunction.h b/deepin-devicemanager/src/commonfunction.h index 32a5124dc..7f8ac14bf 100644 --- a/deepin-devicemanager/src/commonfunction.h +++ b/deepin-devicemanager/src/commonfunction.h @@ -22,7 +22,10 @@ class Common KLVV, KLVU, PGUV, - PGUX + PGUX, + kSpecialType6, + kSpecialType7, + kCustomType }; static QString getArch(); From 19f6a31208d8f78829ce196598dab855c253138d Mon Sep 17 00:00:00 2001 From: gongheng Date: Wed, 23 Jul 2025 09:26:36 +0800 Subject: [PATCH 54/69] feat: [GPU] Add extra information display logic. -- Add extra information display logic. Log: add feature for GPU. Task: https://pms.uniontech.com/task-view-378987.html --- .../customgpuinfo/main.cpp | 3 +- .../src/DeviceManager/DeviceGpu.cpp | 34 ++++++++++++++++--- .../src/DeviceManager/DeviceGpu.h | 4 +++ .../src/DeviceManager/DeviceInfo.cpp | 2 +- .../src/DeviceManager/DeviceInfo.h | 2 +- 5 files changed, 37 insertions(+), 8 deletions(-) diff --git a/deepin-devicemanager-server/customgpuinfo/main.cpp b/deepin-devicemanager-server/customgpuinfo/main.cpp index ec961e915..c26460bd4 100644 --- a/deepin-devicemanager-server/customgpuinfo/main.cpp +++ b/deepin-devicemanager-server/customgpuinfo/main.cpp @@ -10,11 +10,12 @@ #include -// 名称("Name") 厂商("Vendor") 型号("Model") 显存("Graphics Memory") +// 名称("Name") 厂商("Vendor") 型号("Model") 版本(Version) 显存("Graphics Memory") constexpr char kName[] { "Name" }; constexpr char kVendor[] { "Vendor" }; constexpr char kModel[] { "Model" }; +constexpr char kVersion[] { "Version" }; constexpr char kGraphicsMemory[] { "Graphics Memory" }; bool getGpuBaseInfo(QMap &mapInfo) diff --git a/deepin-devicemanager/src/DeviceManager/DeviceGpu.cpp b/deepin-devicemanager/src/DeviceManager/DeviceGpu.cpp index e8b68fdbd..04deee6d8 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceGpu.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceGpu.cpp @@ -284,13 +284,25 @@ void DeviceGpu::setGpuInfo(const QMap &mapInfo) getOtherMapInfo(mapInfo); } -// 名称(Name) 厂商(Vendor) 型号(Model) 显存(Graphics Memory) +// 名称(Name) 厂商(Vendor) 型号(Model) 版本(Version) 显存(Graphics Memory) void DeviceGpu::setGpuInfoByCustom(const QMap &mapInfo) { - setAttribute(mapInfo, "Name", m_Name); - setAttribute(mapInfo, "Vendor", m_Vendor); - setAttribute(mapInfo, "Model", m_Model); - setAttribute(mapInfo, "Graphics Memory", m_GraphicsMemory); + QMap::const_iterator it = mapInfo.constBegin(); + for (; it != mapInfo.constEnd(); ++it) { + if (it.key() == "Name") { + m_Name = it.value(); + } else if (it.key() == "Vendor") { + m_Vendor = it.value(); + } else if (it.key() == "Model") { + m_Model = it.value(); + } else if (it.key() == "Version") { + m_Version = it.value(); + } else if (it.key() == "Graphics Memory") { + m_GraphicsMemory = it.value(); + } else { + m_extraInfo.insert(it.key(), it.value()); + } + } } const QString &DeviceGpu::name() const @@ -350,6 +362,9 @@ void DeviceGpu::loadOtherDeviceInfo() // 将QMap内容转存为QList> mapInfoToList(); + + // 将m_extraInfo追加到m_LstOtherInfo中 + appendExtraInfoToOtherInfo(); } void DeviceGpu::loadTableData() @@ -363,3 +378,12 @@ void DeviceGpu::loadTableData() m_TableData.append(m_Vendor); m_TableData.append(m_Model); } + +void DeviceGpu::appendExtraInfoToOtherInfo() +{ + QMap::const_iterator iter = m_extraInfo.constBegin(); + for (; iter != m_extraInfo.constEnd(); ++iter) { + if (isValueValid(iter.value())) + m_LstOtherInfo.append(QPair(iter.key(), iter.value())); + } +} diff --git a/deepin-devicemanager/src/DeviceManager/DeviceGpu.h b/deepin-devicemanager/src/DeviceManager/DeviceGpu.h index 8a7b61118..85d038d06 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceGpu.h +++ b/deepin-devicemanager/src/DeviceManager/DeviceGpu.h @@ -110,6 +110,9 @@ class DeviceGpu: public DeviceBaseInfo */ void loadTableData() override; +private: + void appendExtraInfoToOtherInfo(); + private: QString m_Model; // m_extraInfo; }; #endif // DEVICEGPU_H diff --git a/deepin-devicemanager/src/DeviceManager/DeviceInfo.cpp b/deepin-devicemanager/src/DeviceManager/DeviceInfo.cpp index 082a90c5b..43d4a7e29 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceInfo.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceInfo.cpp @@ -141,7 +141,7 @@ QString DeviceBaseInfo::subTitle() return QString(""); } -bool DeviceBaseInfo::isValueValid(QString &value) +bool DeviceBaseInfo::isValueValid(const QString &value) { // 判断属性值是否有效 if (value.isEmpty()) diff --git a/deepin-devicemanager/src/DeviceManager/DeviceInfo.h b/deepin-devicemanager/src/DeviceManager/DeviceInfo.h index 6be90b657..e3d6c875e 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceInfo.h +++ b/deepin-devicemanager/src/DeviceManager/DeviceInfo.h @@ -263,7 +263,7 @@ class DeviceBaseInfo : public QObject * @param value:属性值 * @return true:属性值有效 */ - bool isValueValid(QString &value); + bool isValueValid(const QString &value); /** * @brief setForcedDisplay:设置强制显示 From 496262eb58c8f4f8e994eb154dec0c764b7f32e2 Mon Sep 17 00:00:00 2001 From: zhanghongyuan Date: Wed, 23 Jul 2025 14:07:08 +0800 Subject: [PATCH 55/69] fix: Improve supported resolution detection for display devices MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixed refresh rate errors and spelling mistakes in Device Manager → Display → Supported Resolutions. Now accurately obtains resolutions from xrandr output (keeping only integer values) instead of potentially problematic hwinfo detection. Log: Fix display resolution detection method Bug: https://pms.uniontech.com/bug-view-325731.html Change-Id: I377caf0def3455191a3189eac734a608443b47e6 --- .../src/DeviceManager/DeviceManager.cpp | 4 +- .../src/DeviceManager/DeviceManager.h | 2 +- .../src/DeviceManager/DeviceMonitor.cpp | 103 ++++++++++++++++-- .../src/DeviceManager/DeviceMonitor.h | 14 ++- deepin-devicemanager/src/Page/MainWindow.cpp | 10 ++ .../src/Tool/ThreadExecXrandr.cpp | 10 +- 6 files changed, 123 insertions(+), 20 deletions(-) diff --git a/deepin-devicemanager/src/DeviceManager/DeviceManager.cpp b/deepin-devicemanager/src/DeviceManager/DeviceManager.cpp index 98cde0c52..3a052589d 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceManager.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceManager.cpp @@ -1050,7 +1050,7 @@ void DeviceManager::addMonitor(DeviceMonitor *const device) m_ListDeviceMonitor.append(device); } -void DeviceManager::setMonitorInfoFromXrandr(const QString &main, const QString &edid, const QString &rate) +void DeviceManager::setMonitorInfoFromXrandr(const QString &main, const QString &edid, const QString &rate, const QString &xrandr) { // 从xrandr中添加显示设备信息 QList::iterator it = m_ListDeviceMonitor.begin(); @@ -1059,7 +1059,7 @@ void DeviceManager::setMonitorInfoFromXrandr(const QString &main, const QString if (!device) continue; - if (device->setInfoFromXradr(main, edid, rate)) + if (device->setInfoFromXradr(main, edid, rate, xrandr)) return; } } diff --git a/deepin-devicemanager/src/DeviceManager/DeviceManager.h b/deepin-devicemanager/src/DeviceManager/DeviceManager.h index 0d1e34b4e..cc6740b8d 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceManager.h +++ b/deepin-devicemanager/src/DeviceManager/DeviceManager.h @@ -268,7 +268,7 @@ class DeviceManager : public QObject * @param main:主显示器信息 * @param edid:edid信息 */ - void setMonitorInfoFromXrandr(const QString &main, const QString &edid, const QString &rate = ""); + void setMonitorInfoFromXrandr(const QString &main, const QString &edid, const QString &rate = "", const QString &xrandr = ""); /** * @brief setMonitorInfoFromDbus:设置由 dbus 获取的显示设备信息 diff --git a/deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp b/deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp index fe0e76b4d..4c612fa04 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp @@ -16,6 +16,7 @@ // 其它头文件 #include +#include DWIDGET_USE_NAMESPACE @@ -95,7 +96,7 @@ void DeviceMonitor::setInfoFromHwinfo(const QMap &mapInfo) setAttribute(mapInfo, "", m_DisplayInput); setAttribute(mapInfo, "Size", m_ScreenSize); setAttribute(mapInfo, "", m_MainScreen); - setAttribute(mapInfo, "Resolution", m_SupportResolution); +// setAttribute(mapInfo, "Resolution", m_SupportResolution); double inch = 0.0; QSize size(0, 0); @@ -103,19 +104,19 @@ void DeviceMonitor::setInfoFromHwinfo(const QMap &mapInfo) m_ScreenSize = inchValue; // 获取当前分辨率 和 当前支持分辨率 - QStringList listResolution = m_SupportResolution.split(" "); - m_SupportResolution = ""; - foreach (const QString &word, listResolution) { - if (word.contains("@")) { - m_SupportResolution.append(word); - m_SupportResolution.append(", "); - } - } +// QStringList listResolution = m_SupportResolution.split(" "); +// m_SupportResolution = ""; +// foreach (const QString &word, listResolution) { +// if (word.contains("@")) { +// m_SupportResolution.append(word); +// m_SupportResolution.append(", "); +// } +// } // 计算显示比例 caculateScreenRatio(); - m_SupportResolution.replace(QRegExp(", $"), ""); +// m_SupportResolution.replace(QRegExp(", $"), ""); m_ProductionWeek = transWeekToDate(mapInfo["Year of Manufacture"], mapInfo["Week of Manufacture"]); setAttribute(mapInfo, "Serial ID", m_SerialNumber); @@ -174,7 +175,7 @@ QString DeviceMonitor::transWeekToDate(const QString &year, const QString &week) return date.toString("yyyy-MM"); } -bool DeviceMonitor::setInfoFromXradr(const QString &main, const QString &edid, const QString &rate) +bool DeviceMonitor::setInfoFromXradr(const QString &main, const QString &edid, const QString &rate, const QString &xrandr) { if(m_IsTomlSet) return false; @@ -205,6 +206,19 @@ bool DeviceMonitor::setInfoFromXradr(const QString &main, const QString &edid, c m_CurrentResolution = QString("%1").arg(reScreenSize.cap(1)).replace("x", "×", Qt::CaseInsensitive); } } + + QMap monitorResolutionMap = getMonitorResolutionMap(xrandr, m_RawInterface); + + if (monitorResolutionMap.size() == 1) { + m_SupportResolution.clear(); + foreach (const QString &word, monitorResolutionMap.value(m_RawInterface)) { + if (word.contains("@")) { + m_SupportResolution.append(word); + m_SupportResolution.append(", "); + } + } + m_SupportResolution.replace(QRegExp(", $"), ""); + } return false; } @@ -326,6 +340,13 @@ bool DeviceMonitor::setMainInfoFromXrandr(const QString &info, const QString &ra m_Interface = reStart.cap(1); } + if (info.contains("connected")) { + QStringList monitorInfoList = info.split(" ", QString::SkipEmptyParts); + if (monitorInfoList.size() > 0){ + m_RawInterface = monitorInfoList.at(0).trimmed(); + } + } + // wayland xrandr --verbose无primary信息 if (qApp->isDXcbPlatform()) { // 设置是否是主显示器 @@ -452,3 +473,63 @@ bool DeviceMonitor::caculateScreenSize(const QString &edid) m_ScreenSize = QString("%1 %2(%3mm×%4mm)").arg(QString::number(inch, '0', 1)).arg(translateStr("inch")).arg(width).arg(height); return true; } + +QMap DeviceMonitor::getMonitorResolutionMap(QString rawText, QString key, bool round) +{ + QMap monitorResolutionMap; + + if (!rawText.isEmpty()) { + QStringList rawLines = rawText.split("\n", QString::SkipEmptyParts); + + // get the resolution + for (auto line : rawLines) { + + // handel disconnected monitor + if (line.contains("disconnected", Qt::CaseInsensitive)) + continue; + + // handel connected monitor + if (!line.startsWith(" ") && line.contains("connected")) { + QStringList monitorInfoList = line.split(" ", QString::SkipEmptyParts); + if (monitorInfoList.size() > 0){ + monitorResolutionMap.insert(monitorInfoList.at(0).trimmed(), QStringList()); + } + } + + // handel resolution + if (line.startsWith(" ") && !line.contains("connect") && !line.contains(":")){ + QStringList resolutions = line.trimmed().replace("*", "").replace("+", "").split(" ", QString::SkipEmptyParts); + if (resolutions.size() >= 2 && monitorResolutionMap.size() > 0) { + QString resolution = resolutions.at(0); + resolutions.pop_front(); + + for(auto rate : resolutions) { + QString realResolution; + + if (round) { + bool ok = false; + double realRate = rate.toDouble(&ok); + if (ok) { + realResolution = tr("%1@%2Hz").arg(resolution).arg(QString::number(realRate, 'g', realRate >=100 ? 3 : 2)); + } + } else { + realResolution = tr("%1@%2Hz").arg(resolution).arg(rate); + } + + if (!monitorResolutionMap.value(monitorResolutionMap.lastKey()).contains(realResolution)) { + monitorResolutionMap[monitorResolutionMap.lastKey()].append(realResolution); + } + } + } + } + } + } + + if (monitorResolutionMap.keys().contains(key)) { + return QMap{{key, monitorResolutionMap.value(key)}}; + } else { + monitorResolutionMap.clear(); + } + + return monitorResolutionMap; +} diff --git a/deepin-devicemanager/src/DeviceManager/DeviceMonitor.h b/deepin-devicemanager/src/DeviceManager/DeviceMonitor.h index 8b37d2d31..bd32d2b4e 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceMonitor.h +++ b/deepin-devicemanager/src/DeviceManager/DeviceMonitor.h @@ -38,7 +38,7 @@ class DeviceMonitor : public DeviceBaseInfo * @param edid:edid信息 * @return 布尔值,true:信息设置成功;false:信息设置失败 */ - bool setInfoFromXradr(const QString &main, const QString &edid, const QString &rate); + bool setInfoFromXradr(const QString &main, const QString &edid, const QString &rate, const QString &xrandr); // 将年周转化为年月 /** @@ -178,7 +178,14 @@ class DeviceMonitor : public DeviceBaseInfo */ bool caculateScreenSize(const QString &edid); - + /** + * @brief getMonitorResolutionMap:从xrandr字符串获取格式化 + * @param rawText:原始xrandr输出字符串 + * @param key:显示器编号:如 HDMI-0, VGA-1 + * @param round:是否保留整数,如60.00Hz保留后为60Hz + * @return 显示器编号键值对,如{"HDMI-0": ["1920x1080@60Hz, "1920x1080@50Hz",..]} + */ + QMap getMonitorResolutionMap(QString rawText, QString key = "", bool round = true); private: QString m_Model; // #include #include +#include DWIDGET_USE_NAMESPACE using namespace DDLog; @@ -521,6 +522,15 @@ void MainWindow::slotLoadingFinish(const QString &message) if (ret && lst.size() > 0) {//当设备大小为0时,显示概况信息 mp_DeviceWidget->updateDevice(mp_DeviceWidget->currentIndex(), lst); + + // bug-325731 + if (mp_DeviceWidget->currentIndex() == QObject::tr("Monitor")) { + QtConcurrent::run([=](){ + QThread::msleep(700); + emit mp_DeviceWidget->itemClicked(mp_DeviceWidget->currentIndex()); + qWarning() << mp_DeviceWidget->currentIndex(); + }); + } } else { QMap overviewMap = DeviceManager::instance()->getDeviceOverview(); mp_DeviceWidget->updateOverview(overviewMap); diff --git a/deepin-devicemanager/src/Tool/ThreadExecXrandr.cpp b/deepin-devicemanager/src/Tool/ThreadExecXrandr.cpp index a32d2aa8a..330145c0b 100644 --- a/deepin-devicemanager/src/Tool/ThreadExecXrandr.cpp +++ b/deepin-devicemanager/src/Tool/ThreadExecXrandr.cpp @@ -104,6 +104,8 @@ void ThreadExecXrandr::loadXrandrVerboseInfo(QList> &lstM { QString deviceInfo; runCmd(deviceInfo, cmd); + QString xrandInfo; + runCmd(xrandInfo, "xrandr"); QStringList lines = deviceInfo.split("\n"); QStringList::iterator it = lines.begin(); @@ -116,10 +118,11 @@ void ThreadExecXrandr::loadXrandrVerboseInfo(QList> &lstM if (reg.exactMatch(*it) && !(*it).contains("disconnected")) { // 新的显示屏 QMap newMap; - newMap.insert("mainInfo", (*it).trimmed()); + newMap.insert("mainInfo", (*it).trimmed()); auto mainInfoList = (*it).trimmed().split(" "); if (mainInfoList.size() > 0) { newMap.insert("port", mainInfoList.at(0)); + newMap.insert("xrandr", xrandInfo); } lstMap.append(newMap); continue; @@ -147,9 +150,10 @@ void ThreadExecXrandr::loadXrandrVerboseInfo(QList> &lstM // 获取当前频率 if ((*it).contains("*current")) { + // QString ss = *it; if ((it += 2) >= lines.end()) return; - QRegExp regRate(".*([0-9]{1,5}\\.[0-9]{1,5}Hz).*"); + QRegExp regRate(".*([0-9]{1,5}\\.[0-9]{1,5}Hz).*"); if (regRate.exactMatch(*it)) last.insert("rate", regRate.cap(1)); } @@ -246,7 +250,7 @@ void ThreadExecXrandr::getMonitorInfoFromXrandrVerbose() if ((*it).size() < 1) continue; - DeviceManager::instance()->setMonitorInfoFromXrandr((*it)["mainInfo"], (*it)["edid"], (*it)["rate"]); + DeviceManager::instance()->setMonitorInfoFromXrandr((*it)["mainInfo"], (*it)["edid"], (*it)["rate"], (*it)["xrandr"]); } } From b71dbea28742856e627f6e1e4b535bf0ee53dd29 Mon Sep 17 00:00:00 2001 From: zhanghongyuan Date: Thu, 24 Jul 2025 14:51:01 +0800 Subject: [PATCH 56/69] fix: maintain the monitor info in special machine. Maintain the monitor info of supported resolutions in special machine. Log: Maintain the monitor info in special machine. Bug: https://pms.uniontech.com/bug-view-325731.html Change-Id: Iddfadc1ab05f3b81df5469240fde4346ac35e378 --- .../src/DeviceManager/DeviceMonitor.cpp | 45 +++++++++++-------- deepin-devicemanager/src/Page/MainWindow.cpp | 14 +++--- .../src/Tool/ThreadExecXrandr.cpp | 1 - 3 files changed, 34 insertions(+), 26 deletions(-) diff --git a/deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp b/deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp index 4c612fa04..b590dad69 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp @@ -96,7 +96,9 @@ void DeviceMonitor::setInfoFromHwinfo(const QMap &mapInfo) setAttribute(mapInfo, "", m_DisplayInput); setAttribute(mapInfo, "Size", m_ScreenSize); setAttribute(mapInfo, "", m_MainScreen); -// setAttribute(mapInfo, "Resolution", m_SupportResolution); + if (Common::specialComType > 0){ + setAttribute(mapInfo, "Resolution", m_SupportResolution); + } double inch = 0.0; QSize size(0, 0); @@ -104,19 +106,22 @@ void DeviceMonitor::setInfoFromHwinfo(const QMap &mapInfo) m_ScreenSize = inchValue; // 获取当前分辨率 和 当前支持分辨率 -// QStringList listResolution = m_SupportResolution.split(" "); -// m_SupportResolution = ""; -// foreach (const QString &word, listResolution) { -// if (word.contains("@")) { -// m_SupportResolution.append(word); -// m_SupportResolution.append(", "); -// } -// } + if (Common::specialComType > 0){ + QStringList listResolution = m_SupportResolution.split(" "); + m_SupportResolution = ""; + foreach (const QString &word, listResolution) { + if (word.contains("@")) { + m_SupportResolution.append(word); + m_SupportResolution.append(", "); + } + } + } // 计算显示比例 caculateScreenRatio(); - -// m_SupportResolution.replace(QRegExp(", $"), ""); + if (Common::specialComType > 0){ + m_SupportResolution.replace(QRegExp(", $"), ""); + } m_ProductionWeek = transWeekToDate(mapInfo["Year of Manufacture"], mapInfo["Week of Manufacture"]); setAttribute(mapInfo, "Serial ID", m_SerialNumber); @@ -207,17 +212,19 @@ bool DeviceMonitor::setInfoFromXradr(const QString &main, const QString &edid, c } } - QMap monitorResolutionMap = getMonitorResolutionMap(xrandr, m_RawInterface); + if (Common::specialComType <= 0) { + QMap monitorResolutionMap = getMonitorResolutionMap(xrandr, m_RawInterface); - if (monitorResolutionMap.size() == 1) { - m_SupportResolution.clear(); - foreach (const QString &word, monitorResolutionMap.value(m_RawInterface)) { - if (word.contains("@")) { - m_SupportResolution.append(word); - m_SupportResolution.append(", "); + if (monitorResolutionMap.size() == 1) { + m_SupportResolution.clear(); + foreach (const QString &word, monitorResolutionMap.value(m_RawInterface)) { + if (word.contains("@")) { + m_SupportResolution.append(word); + m_SupportResolution.append(", "); + } } + m_SupportResolution.replace(QRegExp(", $"), ""); } - m_SupportResolution.replace(QRegExp(", $"), ""); } return false; } diff --git a/deepin-devicemanager/src/Page/MainWindow.cpp b/deepin-devicemanager/src/Page/MainWindow.cpp index d7206938d..6a932a226 100644 --- a/deepin-devicemanager/src/Page/MainWindow.cpp +++ b/deepin-devicemanager/src/Page/MainWindow.cpp @@ -524,12 +524,14 @@ void MainWindow::slotLoadingFinish(const QString &message) mp_DeviceWidget->updateDevice(mp_DeviceWidget->currentIndex(), lst); // bug-325731 - if (mp_DeviceWidget->currentIndex() == QObject::tr("Monitor")) { - QtConcurrent::run([=](){ - QThread::msleep(700); - emit mp_DeviceWidget->itemClicked(mp_DeviceWidget->currentIndex()); - qWarning() << mp_DeviceWidget->currentIndex(); - }); + if (Common::specialComType <= 0) { + if (mp_DeviceWidget->currentIndex() == QObject::tr("Monitor")) { + QtConcurrent::run([=](){ + QThread::msleep(700); + emit mp_DeviceWidget->itemClicked(mp_DeviceWidget->currentIndex()); + qWarning() << mp_DeviceWidget->currentIndex(); + }); + } } } else { QMap overviewMap = DeviceManager::instance()->getDeviceOverview(); diff --git a/deepin-devicemanager/src/Tool/ThreadExecXrandr.cpp b/deepin-devicemanager/src/Tool/ThreadExecXrandr.cpp index 330145c0b..5d06b5f74 100644 --- a/deepin-devicemanager/src/Tool/ThreadExecXrandr.cpp +++ b/deepin-devicemanager/src/Tool/ThreadExecXrandr.cpp @@ -150,7 +150,6 @@ void ThreadExecXrandr::loadXrandrVerboseInfo(QList> &lstM // 获取当前频率 if ((*it).contains("*current")) { - // QString ss = *it; if ((it += 2) >= lines.end()) return; QRegExp regRate(".*([0-9]{1,5}\\.[0-9]{1,5}Hz).*"); From d705a5ee2158b8136d89c6d7d5e651966ef3d42b Mon Sep 17 00:00:00 2001 From: gongheng Date: Thu, 24 Jul 2025 16:29:39 +0800 Subject: [PATCH 57/69] feat: [GPU] Add logic to show GPU info. -- Clear the preview cache to avoid duplicate infomation accumulation. Log: add feature for GPU. Task: https://pms.uniontech.com/task-view-378987.html --- deepin-devicemanager/src/DeviceManager/DeviceGpu.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/deepin-devicemanager/src/DeviceManager/DeviceGpu.cpp b/deepin-devicemanager/src/DeviceManager/DeviceGpu.cpp index 04deee6d8..8eff786a5 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceGpu.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceGpu.cpp @@ -287,6 +287,7 @@ void DeviceGpu::setGpuInfo(const QMap &mapInfo) // 名称(Name) 厂商(Vendor) 型号(Model) 版本(Version) 显存(Graphics Memory) void DeviceGpu::setGpuInfoByCustom(const QMap &mapInfo) { + m_extraInfo.clear(); QMap::const_iterator it = mapInfo.constBegin(); for (; it != mapInfo.constEnd(); ++it) { if (it.key() == "Name") { From b95f55cf1b04c1afa9751276ecf858acce54d9f5 Mon Sep 17 00:00:00 2001 From: gongheng Date: Thu, 24 Jul 2025 14:09:28 +0800 Subject: [PATCH 58/69] feat: [GPU] Add feature for GPU. -- improve loop performance and reduce stuttering. Log: add feature for GPU. Task: https://pms.uniontech.com/task-view-378987.html --- deepin-devicemanager/src/DeviceManager/DeviceInfo.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/deepin-devicemanager/src/DeviceManager/DeviceInfo.cpp b/deepin-devicemanager/src/DeviceManager/DeviceInfo.cpp index 43d4a7e29..24f00a5a3 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceInfo.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceInfo.cpp @@ -742,7 +742,6 @@ const QString DeviceBaseInfo::readDeviceInfoKeyValue(const QString &key) { if (key.isEmpty()) return QString(""); - // qCInfo(appLog) << __FILE__ << __LINE__ << key << "after translation:"<< kk; QList > allBaseAttribs = getBaseAttribs(); for (const QPair& pair : allBaseAttribs) { if (key == pair.first) @@ -830,9 +829,9 @@ void DeviceBaseInfo::mapInfoToList() { // m_MapOtherInfo --> m_LstOtherInfo // QMap内容转为QList存储 - auto iter = m_MapOtherInfo.begin(); + QMap::const_iterator iter = m_MapOtherInfo.constBegin(); - for (; iter != m_MapOtherInfo.end(); ++iter) { + for (; iter != m_MapOtherInfo.constEnd(); ++iter) { if (isValueValid(iter.value())) m_LstOtherInfo.append(QPair(iter.key(), iter.value())); } From 553f3a9f5fed5677ea2242166b5557beb0ff30ef Mon Sep 17 00:00:00 2001 From: gongheng Date: Thu, 24 Jul 2025 16:15:23 +0800 Subject: [PATCH 59/69] feat: [GPU] Add logic to show GPU info. -- In some special computer, the GPU info not show. -- Add logic to show GPU info. -- Remove duplicate code and improve code readability. Log: add feature for GPU. Task: https://pms.uniontech.com/task-view-378987.html --- .../src/GenerateDevice/HWGenerator.cpp | 47 +------------------ 1 file changed, 2 insertions(+), 45 deletions(-) diff --git a/deepin-devicemanager/src/GenerateDevice/HWGenerator.cpp b/deepin-devicemanager/src/GenerateDevice/HWGenerator.cpp index 088f72f72..32c2d4baa 100644 --- a/deepin-devicemanager/src/GenerateDevice/HWGenerator.cpp +++ b/deepin-devicemanager/src/GenerateDevice/HWGenerator.cpp @@ -7,6 +7,7 @@ #include "EDIDParser.h" #include "commonfunction.h" #include "DDLog.h" +#include "commontools.h" // Qt库文件 #include @@ -412,50 +413,6 @@ void HWGenerator::getMemoryInfoFromLshw() } } -static void parseEDID(QStringList allEDIDS,QString input) -{ - for (auto edid:allEDIDS) { - QProcess process; - process.start(QString("hexdump %1").arg(edid)); - process.waitForFinished(-1); - - QString deviceInfo = process.readAllStandardOutput(); - if (deviceInfo.isEmpty()) - continue; - - QString edidStr; - QStringList lines = deviceInfo.split("\n"); - for (auto line:lines) { - QStringList words = line.trimmed().split(" "); - if (words.size() != 9) - continue; - - words.removeAt(0); - QString l = words.join(""); - l.append("\n"); - edidStr.append(l); - } - - lines = edidStr.split("\n"); - if (lines.size() > 3){ - EDIDParser edidParser; - QString errorMsg; - edidParser.setEdid(edidStr,errorMsg,"\n", false); - - QMap mapInfo; - mapInfo.insert("Vendor",edidParser.vendor()); - mapInfo.insert("Model",edidParser.model()); - //mapInfo.insert("Date",edidParser.releaseDate()); - mapInfo.insert("Size",edidParser.screenSize()); - mapInfo.insert("Display Input",input); - - DeviceMonitor *device = new DeviceMonitor(); - device->setInfoFromEdid(mapInfo); - DeviceManager::instance()->addMonitor(device); - } - } -} - void HWGenerator::generatorMonitorDevice() { QString toDir = "/sys/class/drm"; @@ -473,7 +430,7 @@ void HWGenerator::generatorMonitorDevice() QStringList allEDIDS_all; allEDIDS_all.append(fileInfo.filePath() + "/" + "edid"); QString interface = fileInfo.fileName().remove("card0-").remove("card1-").remove("card2-"); - parseEDID(allEDIDS_all,interface); + CommonTools::parseEDID(allEDIDS_all,interface); } } } From 10e0f8981f57d08b29b6acd9a6ce035f8e6784e8 Mon Sep 17 00:00:00 2001 From: gongheng Date: Tue, 29 Jul 2025 14:49:07 +0800 Subject: [PATCH 60/69] Chore: [cppcheck] Resolve issue identified by cppcheck -- Variable 'ret' is reassinged a value befor the old one has been used. --- .../src/DeviceManager/DeviceComputer.cpp | 8 ++--- .../src/DeviceManager/DeviceCpu.cpp | 36 +++++++++---------- .../src/DeviceManager/DeviceImage.cpp | 12 +++---- .../src/DeviceManager/DeviceInput.cpp | 10 +++--- .../src/DeviceManager/DeviceMemory.cpp | 20 +++++------ .../src/DeviceManager/DeviceMonitor.cpp | 20 +++++------ .../src/DeviceManager/DeviceNetwork.cpp | 36 +++++++++---------- .../src/DeviceManager/DeviceOtherPCI.cpp | 16 ++++----- .../src/DeviceManager/DeviceOthers.cpp | 14 ++++---- .../src/DeviceManager/DevicePower.cpp | 26 +++++++------- .../src/DeviceManager/DevicePrint.cpp | 14 ++++---- .../src/DeviceManager/DeviceStorage.cpp | 16 ++++----- 12 files changed, 114 insertions(+), 114 deletions(-) diff --git a/deepin-devicemanager/src/DeviceManager/DeviceComputer.cpp b/deepin-devicemanager/src/DeviceManager/DeviceComputer.cpp index 5fc1c890e..a263e9262 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceComputer.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceComputer.cpp @@ -24,10 +24,10 @@ TomlFixMethod DeviceComputer::setInfoFromTomlOneByOne(const QMap &m { TomlFixMethod ret = TOML_None; // 添加基本信息 - ret = setTomlAttribute(mapInfo, "CPU ID", m_PhysicalID); - ret = setTomlAttribute(mapInfo, "Core ID", m_CoreID); - ret = setTomlAttribute(mapInfo, "Threads", m_ThreadNum); - ret = setTomlAttribute(mapInfo, "Frequency", m_Frequency); - ret = setTomlAttribute(mapInfo, "Current Frequency", m_CurFrequency); - ret = setTomlAttribute(mapInfo, "Max Frequency", m_MaxFrequency); - ret = setTomlAttribute(mapInfo, "BogoMIPS", m_BogoMIPS); - ret = setTomlAttribute(mapInfo, "Architecture", m_Architecture); - ret = setTomlAttribute(mapInfo, "CPU Family", m_Familly); - ret = setTomlAttribute(mapInfo, "Model", m_Model); + setTomlAttribute(mapInfo, "CPU ID", m_PhysicalID); + setTomlAttribute(mapInfo, "Core ID", m_CoreID); + setTomlAttribute(mapInfo, "Threads", m_ThreadNum); + setTomlAttribute(mapInfo, "Frequency", m_Frequency); + setTomlAttribute(mapInfo, "Current Frequency", m_CurFrequency); + setTomlAttribute(mapInfo, "Max Frequency", m_MaxFrequency); + setTomlAttribute(mapInfo, "BogoMIPS", m_BogoMIPS); + setTomlAttribute(mapInfo, "Architecture", m_Architecture); + setTomlAttribute(mapInfo, "CPU Family", m_Familly); + setTomlAttribute(mapInfo, "Model", m_Model); // 添加其他信息,成员变量 - ret = setTomlAttribute(mapInfo, "Virtualization", m_HardwareVirtual); - ret = setTomlAttribute(mapInfo, "Flags", m_Flags); - ret = setTomlAttribute(mapInfo, "Extensions", m_Extensions); - ret = setTomlAttribute(mapInfo, "L4 Cache", m_CacheL4); - ret = setTomlAttribute(mapInfo, "L3 Cache", m_CacheL3); - ret = setTomlAttribute(mapInfo, "L2 Cache", m_CacheL2); - ret = setTomlAttribute(mapInfo, "L1i Cache", m_CacheL1Order); - ret = setTomlAttribute(mapInfo, "L1d Cache", m_CacheL1Data); + setTomlAttribute(mapInfo, "Virtualization", m_HardwareVirtual); + setTomlAttribute(mapInfo, "Flags", m_Flags); + setTomlAttribute(mapInfo, "Extensions", m_Extensions); + setTomlAttribute(mapInfo, "L4 Cache", m_CacheL4); + setTomlAttribute(mapInfo, "L3 Cache", m_CacheL3); + setTomlAttribute(mapInfo, "L2 Cache", m_CacheL2); + setTomlAttribute(mapInfo, "L1i Cache", m_CacheL1Order); + setTomlAttribute(mapInfo, "L1d Cache", m_CacheL1Data); ret = setTomlAttribute(mapInfo, "Stepping", m_Step); //3. 获取设备的其它信息 getOtherMapInfo(mapInfo); diff --git a/deepin-devicemanager/src/DeviceManager/DeviceImage.cpp b/deepin-devicemanager/src/DeviceManager/DeviceImage.cpp index 53f3608a0..6a39ec33d 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceImage.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceImage.cpp @@ -44,13 +44,13 @@ TomlFixMethod DeviceImage::setInfoFromTomlOneByOne(const QMap TomlFixMethod ret = TOML_None; // 添加基本信息 - ret = setTomlAttribute(mapInfo, "Model", m_Model); - ret = setTomlAttribute(mapInfo, "Bus Info", m_BusInfo); - ret = setTomlAttribute(mapInfo, "Version", m_Version); + setTomlAttribute(mapInfo, "Model", m_Model); + setTomlAttribute(mapInfo, "Bus Info", m_BusInfo); + setTomlAttribute(mapInfo, "Version", m_Version); // 添加其他信息,成员变量 - ret = setTomlAttribute(mapInfo, "Speed", m_Speed); - ret = setTomlAttribute(mapInfo, "Maximum Power", m_MaximumPower); - ret = setTomlAttribute(mapInfo, "Capabilities", m_Capabilities); + setTomlAttribute(mapInfo, "Speed", m_Speed); + setTomlAttribute(mapInfo, "Maximum Power", m_MaximumPower); + setTomlAttribute(mapInfo, "Capabilities", m_Capabilities); ret = setTomlAttribute(mapInfo, "Serial Number", m_SerialID); //3. 获取设备的其它信息 getOtherMapInfo(mapInfo); diff --git a/deepin-devicemanager/src/DeviceManager/DeviceInput.cpp b/deepin-devicemanager/src/DeviceManager/DeviceInput.cpp index 3c04e15b3..23de65159 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceInput.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceInput.cpp @@ -67,12 +67,12 @@ TomlFixMethod DeviceInput::setInfoFromTomlOneByOne(const QMap { TomlFixMethod ret = TOML_None; // 添加基本信息 - ret = setTomlAttribute(mapInfo, "Model", m_Model); - ret = setTomlAttribute(mapInfo, "Interface", m_Interface); - ret = setTomlAttribute(mapInfo, "Bus Info", m_BusInfo); + setTomlAttribute(mapInfo, "Model", m_Model); + setTomlAttribute(mapInfo, "Interface", m_Interface); + setTomlAttribute(mapInfo, "Bus Info", m_BusInfo); // 添加其他信息,成员变量 - ret = setTomlAttribute(mapInfo, "Speed", m_Speed); - ret = setTomlAttribute(mapInfo, "Maximum Current", m_MaximumPower); // 将最大功率改为最大电流 + setTomlAttribute(mapInfo, "Speed", m_Speed); + setTomlAttribute(mapInfo, "Maximum Current", m_MaximumPower); // 将最大功率改为最大电流 ret = setTomlAttribute(mapInfo, "Capabilities", m_Capabilities); //3. 获取设备的其它信息 diff --git a/deepin-devicemanager/src/DeviceManager/DeviceMemory.cpp b/deepin-devicemanager/src/DeviceManager/DeviceMemory.cpp index 01385cbe3..bd52da9ae 100755 --- a/deepin-devicemanager/src/DeviceManager/DeviceMemory.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceMemory.cpp @@ -54,17 +54,17 @@ TomlFixMethod DeviceMemory::setInfoFromTomlOneByOne(const QMap { TomlFixMethod ret = TOML_None; // 添加基本信息 - ret = setTomlAttribute(mapInfo, "Size", m_Size); - ret = setTomlAttribute(mapInfo, "Type", m_Type); - ret = setTomlAttribute(mapInfo, "Speed", m_Speed); - ret = setTomlAttribute(mapInfo, "Total Width", m_TotalBandwidth); - ret = setTomlAttribute(mapInfo, "Locator", m_Locator); - ret = setTomlAttribute(mapInfo, "Serial Number", m_SerialNumber); + setTomlAttribute(mapInfo, "Size", m_Size); + setTomlAttribute(mapInfo, "Type", m_Type); + setTomlAttribute(mapInfo, "Speed", m_Speed); + setTomlAttribute(mapInfo, "Total Width", m_TotalBandwidth); + setTomlAttribute(mapInfo, "Locator", m_Locator); + setTomlAttribute(mapInfo, "Serial Number", m_SerialNumber); // 添加其他信息,成员变量 - ret = setTomlAttribute(mapInfo, "Configured Voltage", m_ConfiguredVoltage); - ret = setTomlAttribute(mapInfo, "Maximum Voltage", m_MaximumVoltage); - ret = setTomlAttribute(mapInfo, "Minimum Voltage", m_MinimumVoltage); - ret = setTomlAttribute(mapInfo, "Configured Speed", m_ConfiguredSpeed); + setTomlAttribute(mapInfo, "Configured Voltage", m_ConfiguredVoltage); + setTomlAttribute(mapInfo, "Maximum Voltage", m_MaximumVoltage); + setTomlAttribute(mapInfo, "Minimum Voltage", m_MinimumVoltage); + setTomlAttribute(mapInfo, "Configured Speed", m_ConfiguredSpeed); ret = setTomlAttribute(mapInfo, "Data Width", m_DataBandwidth); //3. 获取设备的其它信息 getOtherMapInfo(mapInfo); diff --git a/deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp b/deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp index b590dad69..cecadcdb8 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp @@ -136,17 +136,17 @@ TomlFixMethod DeviceMonitor::setInfoFromTomlOneByOne(const QMap &mapInfo) { TomlFixMethod ret = TOML_None; - // 添加基本信息 - ret = setTomlAttribute(mapInfo, "Model", m_Model); - ret = setTomlAttribute(mapInfo, "Bus Info", m_BusInfo); + // 添加基本信息 + setTomlAttribute(mapInfo, "Model", m_Model); + setTomlAttribute(mapInfo, "Bus Info", m_BusInfo); // 添加其他信息,成员变量 - ret = setTomlAttribute(mapInfo, "Input/Output", m_InputOutput); - ret = setTomlAttribute(mapInfo, "Memory", m_Memory); - ret = setTomlAttribute(mapInfo, "IRQ", m_Irq); - ret = setTomlAttribute(mapInfo, "Latency", m_Latency); + setTomlAttribute(mapInfo, "Input/Output", m_InputOutput); + setTomlAttribute(mapInfo, "Memory", m_Memory); + setTomlAttribute(mapInfo, "IRQ", m_Irq); + setTomlAttribute(mapInfo, "Latency", m_Latency); ret = setTomlAttribute(mapInfo, "Capabilities", m_Version); -//3. 获取设备的其它信息 + //3. 获取设备的其它信息 getOtherMapInfo(mapInfo); return ret; } diff --git a/deepin-devicemanager/src/DeviceManager/DeviceOthers.cpp b/deepin-devicemanager/src/DeviceManager/DeviceOthers.cpp index 96e1b6486..e049ac577 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceOthers.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceOthers.cpp @@ -53,14 +53,14 @@ TomlFixMethod DeviceOthers::setInfoFromTomlOneByOne(const QMap { TomlFixMethod ret = TOML_None; // 添加基本信息 - ret = setTomlAttribute(mapInfo, "Model", m_Model); - ret = setTomlAttribute(mapInfo, "Bus Info", m_BusInfo); - ret = setTomlAttribute(mapInfo, "Capabilities", m_Capabilities); - ret = setTomlAttribute(mapInfo, "Maximum Power", m_MaximumPower); - ret = setTomlAttribute(mapInfo, "Speed", m_Speed); -////Others + setTomlAttribute(mapInfo, "Model", m_Model); + setTomlAttribute(mapInfo, "Bus Info", m_BusInfo); + setTomlAttribute(mapInfo, "Capabilities", m_Capabilities); + setTomlAttribute(mapInfo, "Maximum Power", m_MaximumPower); + setTomlAttribute(mapInfo, "Speed", m_Speed); + // Others ret = setTomlAttribute(mapInfo, "Serial Number", m_SerialID); -//3. 获取设备的其它信息 + // 3. 获取设备的其它信息 getOtherMapInfo(mapInfo); return ret; } diff --git a/deepin-devicemanager/src/DeviceManager/DevicePower.cpp b/deepin-devicemanager/src/DeviceManager/DevicePower.cpp index 81fc412ef..c55070a46 100644 --- a/deepin-devicemanager/src/DeviceManager/DevicePower.cpp +++ b/deepin-devicemanager/src/DeviceManager/DevicePower.cpp @@ -44,19 +44,19 @@ TomlFixMethod DevicePower::setInfoFromTomlOneByOne(const QMap { TomlFixMethod ret = TOML_None; // 添加基本信息 - ret = setTomlAttribute(mapInfo, "Model", m_Model); - ret = setTomlAttribute(mapInfo, "Serial Number", m_SerialNumber); - ret = setTomlAttribute(mapInfo, "Type", m_Type); - ret = setTomlAttribute(mapInfo, "Status", m_Status); - ret = setTomlAttribute(mapInfo, "Capacity", m_Capacity); - ret = setTomlAttribute(mapInfo, "Voltage", m_Voltage); - ret = setTomlAttribute(mapInfo, "Slot", m_Slot); - ret = setTomlAttribute(mapInfo, "Design Capacity", m_DesignCapacity); - ret = setTomlAttribute(mapInfo, "Design Voltage", m_DesignVoltage); - ret = setTomlAttribute(mapInfo, "SBDS Version", m_SBDSVersion); - ret = setTomlAttribute(mapInfo, "SBDS Serial Number", m_SBDSSerialNumber); - ret = setTomlAttribute(mapInfo, "SBDS Manufacture Date", m_SBDSManufactureDate); - ret = setTomlAttribute(mapInfo, "SBDS Chemistry", m_SBDSChemistry); + setTomlAttribute(mapInfo, "Model", m_Model); + setTomlAttribute(mapInfo, "Serial Number", m_SerialNumber); + setTomlAttribute(mapInfo, "Type", m_Type); + setTomlAttribute(mapInfo, "Status", m_Status); + setTomlAttribute(mapInfo, "Capacity", m_Capacity); + setTomlAttribute(mapInfo, "Voltage", m_Voltage); + setTomlAttribute(mapInfo, "Slot", m_Slot); + setTomlAttribute(mapInfo, "Design Capacity", m_DesignCapacity); + setTomlAttribute(mapInfo, "Design Voltage", m_DesignVoltage); + setTomlAttribute(mapInfo, "SBDS Version", m_SBDSVersion); + setTomlAttribute(mapInfo, "SBDS Serial Number", m_SBDSSerialNumber); + setTomlAttribute(mapInfo, "SBDS Manufacture Date", m_SBDSManufactureDate); + setTomlAttribute(mapInfo, "SBDS Chemistry", m_SBDSChemistry); ret = setTomlAttribute(mapInfo, "Temperature", m_Temp); //3. 获取设备的其它信息 getOtherMapInfo(mapInfo); diff --git a/deepin-devicemanager/src/DeviceManager/DevicePrint.cpp b/deepin-devicemanager/src/DeviceManager/DevicePrint.cpp index 3fe00334f..5da2da2e4 100644 --- a/deepin-devicemanager/src/DeviceManager/DevicePrint.cpp +++ b/deepin-devicemanager/src/DeviceManager/DevicePrint.cpp @@ -31,15 +31,15 @@ TomlFixMethod DevicePrint::setInfoFromTomlOneByOne(const QMap { TomlFixMethod ret = TOML_None; // 添加基本信息 - ret = setTomlAttribute(mapInfo, "Model", m_Model); - ret = setTomlAttribute(mapInfo, "Serial Number", m_SerialNumber); + setTomlAttribute(mapInfo, "Model", m_Model); + setTomlAttribute(mapInfo, "Serial Number", m_SerialNumber); // 添加其他信息,成员变量 - ret = setTomlAttribute(mapInfo, "Shared", m_Shared); - ret = setTomlAttribute(mapInfo, "URI", m_URI); - ret = setTomlAttribute(mapInfo, "Status", m_Status); - ret = setTomlAttribute(mapInfo, "Interface Type", m_InterfaceType); + setTomlAttribute(mapInfo, "Shared", m_Shared); + setTomlAttribute(mapInfo, "URI", m_URI); + setTomlAttribute(mapInfo, "Status", m_Status); + setTomlAttribute(mapInfo, "Interface Type", m_InterfaceType); ret = setTomlAttribute(mapInfo, "printer-make-and-model", m_MakeAndModel); -//3. 获取设备的其它信息 + // 3. 获取设备的其它信息 getOtherMapInfo(mapInfo); return ret; } diff --git a/deepin-devicemanager/src/DeviceManager/DeviceStorage.cpp b/deepin-devicemanager/src/DeviceManager/DeviceStorage.cpp index 2019a43c6..0c0d88e4a 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceStorage.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceStorage.cpp @@ -41,16 +41,16 @@ TomlFixMethod DeviceStorage::setInfoFromTomlOneByOne(const QMap Date: Tue, 29 Jul 2025 15:13:14 +0800 Subject: [PATCH 61/69] Perf: [cppcheck] parameter should be passed by const reference. -- Local variable "items" shadows outer variable. -- Function parameter should be passed by const reference. --- deepin-devicemanager/src/DeviceManager/DeviceGpu.cpp | 8 ++++---- deepin-devicemanager/src/DeviceManager/DeviceManager.cpp | 2 +- deepin-devicemanager/src/DeviceManager/DeviceManager.h | 2 +- deepin-devicemanager/src/DeviceManager/DeviceNetwork.cpp | 2 +- deepin-devicemanager/src/DeviceManager/DeviceNetwork.h | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/deepin-devicemanager/src/DeviceManager/DeviceGpu.cpp b/deepin-devicemanager/src/DeviceManager/DeviceGpu.cpp index 8eff786a5..1d45c2c64 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceGpu.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceGpu.cpp @@ -168,12 +168,12 @@ bool DeviceGpu::setHwinfoInfo(const QMap &mapInfo) foreach (const QString &item, items) { if (item.isEmpty()) continue; - QStringList items = allStr.split(":", QString::SkipEmptyParts); - if (items.size() != 2) + QStringList tmpItems = allStr.split(":", QString::SkipEmptyParts); + if (tmpItems.size() != 2) continue; - if (items.first().trimmed() == "VRAM total size") { + if (tmpItems.first().trimmed() == "VRAM total size") { bool ok; - quint64 vramSize = items.last().trimmed().toULong(&ok, 16); + quint64 vramSize = tmpItems.last().trimmed().toULong(&ok, 16); if (ok && vramSize >= 1048576) { vramSize /= 1048576; auto curSize = vramSize / 1024.0; diff --git a/deepin-devicemanager/src/DeviceManager/DeviceManager.cpp b/deepin-devicemanager/src/DeviceManager/DeviceManager.cpp index 3a052589d..ab0542521 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceManager.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceManager.cpp @@ -1299,7 +1299,7 @@ DeviceBaseInfo *DeviceManager::getNetworkDevice(const QString &unique_id) return nullptr; } -void DeviceManager::correctNetworkLinkStatus(QString linkStatus, QString networkDriver) +void DeviceManager::correctNetworkLinkStatus(const QString &linkStatus, const QString &networkDriver) { if (m_ListDeviceNetwork.size() == 0) return; diff --git a/deepin-devicemanager/src/DeviceManager/DeviceManager.h b/deepin-devicemanager/src/DeviceManager/DeviceManager.h index cc6740b8d..53458b821 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceManager.h +++ b/deepin-devicemanager/src/DeviceManager/DeviceManager.h @@ -387,7 +387,7 @@ class DeviceManager : public QObject * @brief correctNetworkLinkStatus:校正网络连接状态 * @param linkStatus:连接状态 */ - void correctNetworkLinkStatus(QString linkStatus, QString networkDriver); + void correctNetworkLinkStatus(const QString &linkStatus, const QString &networkDriver); /** * @brief networkDriver:获取所有网络驱动 diff --git a/deepin-devicemanager/src/DeviceManager/DeviceNetwork.cpp b/deepin-devicemanager/src/DeviceManager/DeviceNetwork.cpp index 68799a50e..1ea6179d2 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceNetwork.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceNetwork.cpp @@ -224,7 +224,7 @@ bool DeviceNetwork::enable() return m_Enable; } -void DeviceNetwork::correctCurrentLinkStatus(QString linkStatus) +void DeviceNetwork::correctCurrentLinkStatus(const QString &linkStatus) { if (m_Link != linkStatus) m_Link = linkStatus; diff --git a/deepin-devicemanager/src/DeviceManager/DeviceNetwork.h b/deepin-devicemanager/src/DeviceManager/DeviceNetwork.h index 6b050289a..1bbda454d 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceNetwork.h +++ b/deepin-devicemanager/src/DeviceManager/DeviceNetwork.h @@ -92,7 +92,7 @@ class DeviceNetwork : public DeviceBaseInfo * @brief correctCurrentLinkStatus * @param linkStatus */ - void correctCurrentLinkStatus(QString linkStatus); + void correctCurrentLinkStatus(const QString &linkStatus); /** * @brief logicalName: 获取网卡逻辑名称 From 6e5ecd717ab12febf479e58f561eeb79dee7e078 Mon Sep 17 00:00:00 2001 From: zhanghongyuan Date: Tue, 29 Jul 2025 11:20:42 +0800 Subject: [PATCH 62/69] fix: Update input device Bus interface display Corrected I2C protocol touchpad showing as PS/2 interface in Device Manager, and updated input device interface detection rules. Log: Fix incorrect Bus interface display for I2C devices Bug: https://pms.uniontech.com/bug-view-326531.html Task: https://pms.uniontech.com/task-view-379781.html Change-Id: Id30e6e792ce8757de50a53e68fec6af69d490644 --- .../src/DeviceManager/DeviceInput.cpp | 98 ++++++++++++++++++- .../src/DeviceManager/DeviceInput.h | 23 +++++ 2 files changed, 120 insertions(+), 1 deletion(-) diff --git a/deepin-devicemanager/src/DeviceManager/DeviceInput.cpp b/deepin-devicemanager/src/DeviceManager/DeviceInput.cpp index 23de65159..9e03227ac 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceInput.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceInput.cpp @@ -56,6 +56,7 @@ bool DeviceInput::setInfoFromlshw(const QMap &mapInfo) if (m_Driver.isEmpty() && "PS/2" == m_Interface) { m_CanUninstall = false; } + getMouseInfoFromBusDevice(); // 获取其他设备信息 getOtherMapInfo(mapInfo); @@ -146,6 +147,7 @@ void DeviceInput::setInfoFromHwinfo(const QMap &mapInfo) // 由bluetoothctl paired-devices设置设备接口 setInfoFromBluetoothctl(); + getMouseInfoFromBusDevice(); // 获取其他设备信息 getOtherMapInfo(mapInfo); } @@ -261,6 +263,100 @@ QString DeviceInput::eventStrFromDeviceFiles(const QString &dfs) return ""; } +InputDeviceBusInfo DeviceInput::getDetailBusInfo(const QString &busId) +{ + InputDeviceBusInfo info; + info.busId = busId; + + // 根据 Bus ID 查找对应的接口类型信息-只会使用 interfaceType,其他内容预留维护参考 + static QMap busInfoMap = { + {"0000", {"0000", "UINPUT", "虚拟设备", "用于软件模拟输入"}}, + {"0001", {"0001", "PCI", "特殊输入卡", "通过 PCI/PCIe 总线连接的设备"}}, + {"0002", {"0002", "ISA", "古老 ISA 设备", "已淘汰的 ISA 接口设备"}}, + {"0003", {"0003", "USB", "USB鼠标/键盘/手柄", "最常见的外设接口,设备路径含 usb"}}, + {"0004", {"0004", "HIL", "HP-HIL终端设备", "历史遗留系统 (HP-HIL)"}}, + {"0005", {"0005", "BLUETOOTH", "蓝牙鼠标/键盘", "设备名称含 bluetooth,需 rfkill 管理"}}, + {"0006", {"0006", "VIRTUAL", "VMware/QEMU虚拟输入", "虚拟机中的输入设备"}}, + {"0007", {"0007", "SERIAL)", "串口鼠标", "设备节点为 /dev/ttyS*"}}, + {"0008", {"0008", "HOST", "内置键盘/触摸板", "通过主板直接连接的设备"}}, + {"0009", {"0009", "Game Port", "游戏手柄", "15针 D-Sub 接口"}}, + {"0010", {"0010", "PARALLEL", "老式输入设备", "/dev/parport*"}}, + {"0011", {"0011", "PS/2", "PS/2鼠标/键盘", "圆形 6-pin 接口,设备节点为 /dev/psaux"}}, + {"0012", {"0012", "RADIO", "无线接收器", "专用 2.4G 设备 (如罗技 Unifying)"}}, + {"0013", {"0013", "J1939", "车载工业设备", "CAN 总线扩展"}}, + {"0018", {"0018", "I2C", "高端触摸板/触控笔", "设备名称含 i2c,需 i2c-tools 调试"}}, + {"0019", {"0019", "SPI", "嵌入式触控屏", "通过 SPI 总线通信"}}, + {"001a", {"001A", "ILLUMINANCE", "环境光传感器", "部分笔记本的自动亮度调节"}}, + {"001b", {"001B", "GDIX", "Surface Dial", "微软 Surface Dial 特殊旋转输入设备"}}, + {"001c", {"001C", "WACOM", "数位板/绘图屏", "设备名含 wacom"}}, + {"001d", {"001D", "UCSI", "USB Type-C输入", "新式笔记本的 USB-C 扩展设备"}} + }; + + // 查找匹配的 Bus ID (不区分大小写) + QString lowerBusId = busId.toLower(); + if (busInfoMap.contains(lowerBusId)) { + return busInfoMap.value(lowerBusId); + } + + // 如果没有找到匹配的,返回未知类型 + info.interfaceType = "Unknown"; + info.typicalDevices = "UnKnown Device"; + info.description = QString("Unrecognized Bus ID: %1").arg(busId); + + return info; +} + +void DeviceInput::getMouseInfoFromBusDevice() +{ + QProcess process; + process.start("cat", QStringList() << "/proc/bus/input/devices"); + process.waitForFinished(10000); + QString rawContent = process.readAllStandardOutput(); + + QMap nameToBusMap; + + if (rawContent.isEmpty()) { + return ; + } + + QStringList deviceBlocks = rawContent.split("\n\n", QString::SkipEmptyParts); + + for (const QString &block : deviceBlocks) { + QString bus, name; + QStringList lines = block.split("\n", QString::SkipEmptyParts); + + for (const QString &line : lines) { + QString trimmedLine = line.trimmed(); + + // 提取 Bus 信息 (I: Bus=0019 ...) + if (trimmedLine.startsWith("I:") && trimmedLine.contains("Bus=")) { + QRegExp busRegex("Bus=([0-9a-fA-F]+)"); + if (busRegex.indexIn(trimmedLine) != -1) { + bus = busRegex.cap(1); + } + } + + // 提取 Name 信息 (N: Name="Sleep Button") + if (trimmedLine.startsWith("N:") && trimmedLine.contains("Name=")) { + QRegExp nameRegex("Name=\"([^\"]+)\""); + if (nameRegex.indexIn(trimmedLine) != -1) { + name = nameRegex.cap(1); + } + } + } + + // 如果同时找到了 name 和 bus,则添加到映射中 + if (!name.isEmpty() && !bus.isEmpty()) { + nameToBusMap.insert(name, bus); + } + } + + if (nameToBusMap.contains(m_Name)) { + QString busID = nameToBusMap.value(m_Name); + m_Interface = getDetailBusInfo(busID).interfaceType; + } +} + QString DeviceInput::getBusInfo() const { return m_SysPath; @@ -291,7 +387,7 @@ bool DeviceInput::available() if (driver().isEmpty()) { m_Available = false; } - if ("PS/2" == m_Interface || "Bluetooth" == m_Interface) { + if ("PS/2" == m_Interface || "Bluetooth" == m_Interface || "I2C" == m_Interface) { m_Available = true; } return m_forcedDisplay ? m_forcedDisplay : m_Available; diff --git a/deepin-devicemanager/src/DeviceManager/DeviceInput.h b/deepin-devicemanager/src/DeviceManager/DeviceInput.h index 2320df7c0..35e776f9c 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceInput.h +++ b/deepin-devicemanager/src/DeviceManager/DeviceInput.h @@ -8,6 +8,17 @@ #include "DeviceInfo.h" +/** + * @brief The InputDeviceBusInfo class + * 描述InputDevice设备的Bus信息 + */ +struct InputDeviceBusInfo { + QString busId; + QString interfaceType; + QString typicalDevices; + QString description; +}; + /** * @brief The DeviceInput class * 用来描述输入设备的类 @@ -171,6 +182,18 @@ class DeviceInput : public DeviceBaseInfo */ QString eventStrFromDeviceFiles(const QString &dfs); + /** + * @brief getDetailBusInfo + * @param busId Bus ID类别号 + * @return + */ + InputDeviceBusInfo getDetailBusInfo(const QString &busId); + + /** + * @brief getMouseInfoFromBusDevice + * 实时从/proc/bus/input/devices获取设备接口信息 + */ + void getMouseInfoFromBusDevice(); private: QString m_Model; // Date: Tue, 29 Jul 2025 19:31:33 +0800 Subject: [PATCH 63/69] Feat: [Monitor] The monitor name show error. -- parse the edid ,and show the right monitor name. Log: add feature for Monitor. Task: https://pms.uniontech.com/task-view-379819.html --- .../src/DeviceManager/DeviceMonitor.cpp | 11 +++ .../src/DeviceManager/DeviceMonitor.h | 2 + .../src/GenerateDevice/CustomGenerator.cpp | 2 +- .../src/GenerateDevice/HWGenerator.cpp | 2 +- deepin-devicemanager/src/Tool/EDIDParser.cpp | 68 +++++++++++++++- deepin-devicemanager/src/Tool/EDIDParser.h | 12 +++ deepin-devicemanager/src/Tool/commontools.cpp | 80 ++++++++++++++----- deepin-devicemanager/src/Tool/commontools.h | 2 +- 8 files changed, 154 insertions(+), 25 deletions(-) diff --git a/deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp b/deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp index cecadcdb8..1c1ea6811 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp @@ -164,6 +164,17 @@ void DeviceMonitor::setInfoFromEdid(const QMap &mapInfo) getOtherMapInfo(mapInfo); } +void DeviceMonitor::setInfoFromEdidForCustom(const QMap &mapInfo) +{ + setAttribute(mapInfo, "Size", m_ScreenSize); + setAttribute(mapInfo, "Vendor", m_Vendor); + setAttribute(mapInfo, "Date", m_ProductionWeek); + setAttribute(mapInfo, "Display Input", m_DisplayInput); + setAttribute(mapInfo, "Model", m_Model); + m_Name = m_Model; + getOtherMapInfo(mapInfo); +} + void DeviceMonitor::setInfoFromDbus(const QMap &mapInfo) { if (mapInfo["Name"].toLower().contains(m_DisplayInput.toLower(), Qt::CaseInsensitive)) { diff --git a/deepin-devicemanager/src/DeviceManager/DeviceMonitor.h b/deepin-devicemanager/src/DeviceManager/DeviceMonitor.h index bd32d2b4e..22bdb222f 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceMonitor.h +++ b/deepin-devicemanager/src/DeviceManager/DeviceMonitor.h @@ -67,6 +67,8 @@ class DeviceMonitor : public DeviceBaseInfo */ void setInfoFromEdid(const QMap &mapInfo); + void setInfoFromEdidForCustom(const QMap &mapInfo); + /**@brief:华为PanGuV项目里面的显示屏信息是从dbus里面获取的*/ /** * @brief setInfoFromDbus:设置华为PanGuV项目里面的显示屏信息 diff --git a/deepin-devicemanager/src/GenerateDevice/CustomGenerator.cpp b/deepin-devicemanager/src/GenerateDevice/CustomGenerator.cpp index 046250a8b..f7f661ce0 100644 --- a/deepin-devicemanager/src/GenerateDevice/CustomGenerator.cpp +++ b/deepin-devicemanager/src/GenerateDevice/CustomGenerator.cpp @@ -86,7 +86,7 @@ void CustomGenerator::generatorMonitorDevice() QStringList allEDIDS_all; allEDIDS_all.append(fileInfo.filePath() + "/" + "edid"); QString interface = fileInfo.fileName().remove("card0-").remove("card1-").remove("card2-"); - CommonTools::parseEDID(allEDIDS_all, interface); + CommonTools::parseEDID(allEDIDS_all, interface, false); } } } diff --git a/deepin-devicemanager/src/GenerateDevice/HWGenerator.cpp b/deepin-devicemanager/src/GenerateDevice/HWGenerator.cpp index 32c2d4baa..a279be325 100644 --- a/deepin-devicemanager/src/GenerateDevice/HWGenerator.cpp +++ b/deepin-devicemanager/src/GenerateDevice/HWGenerator.cpp @@ -430,7 +430,7 @@ void HWGenerator::generatorMonitorDevice() QStringList allEDIDS_all; allEDIDS_all.append(fileInfo.filePath() + "/" + "edid"); QString interface = fileInfo.fileName().remove("card0-").remove("card1-").remove("card2-"); - CommonTools::parseEDID(allEDIDS_all,interface); + CommonTools::parseEDID(allEDIDS_all, interface, true); } } } diff --git a/deepin-devicemanager/src/Tool/EDIDParser.cpp b/deepin-devicemanager/src/Tool/EDIDParser.cpp index 082adbaa8..634488ef3 100644 --- a/deepin-devicemanager/src/Tool/EDIDParser.cpp +++ b/deepin-devicemanager/src/Tool/EDIDParser.cpp @@ -78,7 +78,8 @@ bool EDIDParser::setEdid(const QString &edid, QString &errorMsg, const QString & parseReleaseDate(); // 解析屏幕尺寸 parseScreenSize(); - + // 解析监视器名称 + parseMonitorName(); return true; } @@ -103,6 +104,11 @@ const QString &EDIDParser::screenSize()const return m_ScreenSize; } +const QString &EDIDParser::monitorName() const +{ + return m_MonitorName; +} + int EDIDParser::width() { return m_Width; @@ -213,6 +219,66 @@ void EDIDParser::parseScreenSize() m_ScreenSize = QString("%1 %2(%3mm×%4mm)").arg(QString::number(inch, '0', Common::specialComType == 7 ? 0 : 1)).arg(QObject::tr("inch")).arg(m_Width).arg(m_Height); } +void EDIDParser::parseMonitorName() +{ + // EDID中从字节54开始有4个18字节的Descriptor Block + // 每个Descriptor Block可能包含显示器名称信息 + // 显示器名称的标识符是0xFC(Display Product Name) 注意:部分机型有一些特殊,标识符为0xFE + + // 4个Descriptor Block的起始字节位置 + int descriptorStarts[4] = {54, 72, 90, 108}; + + for (int i = 0; i < 4; i++) { + int startByte = descriptorStarts[i]; + + // 计算行号和字节位置(每行16字节) + int line = startByte / 16; + int byteInLine = startByte % 16; + + // 获取Descriptor Block的关键字节 + QString byte0 = getBytes(line, byteInLine); // 第0字节 + QString byte1 = getBytes(line, byteInLine + 1); // 第1字节 + QString byte3 = getBytes(line, byteInLine + 3); // 第3字节(类型标识) + + // 检查是否为Display Descriptor (字节0-1为0x0000) 且类型为Display Product Name (字节3为0xFC) + if (byte0.toUpper() == "00" && byte1.toUpper() == "00" && (byte3.toUpper() == "FC" || byte3.toUpper() == "FE")) { + + // 找到显示器名称描述符,提取ASCII字符串(字节5-17) + QString monitorName; + + for (int j = 5; j <= 17; j++) { + int currentByte = startByte + j; + int currentLine = currentByte / 16; + int currentByteInLine = currentByte % 16; + + QString charByte = getBytes(currentLine, currentByteInLine); + + if (!charByte.isEmpty()) { + int asciiValue = hexToDec(charByte).toInt(); + + // ASCII可打印字符范围:32-126,0x0A为换行符,0x00为结束符 + if (asciiValue == 0x00 || asciiValue == 0x0A) { + break; // 遇到结束符或换行符,停止解析 + } else if (asciiValue >= 32 && asciiValue <= 126) { + monitorName.append(QChar(asciiValue)); + } + } + } + + // 去除首尾空白字符 + m_MonitorName = monitorName.trimmed(); + + // 如果找到有效的监视器名称,记录日志并返回 + if (!m_MonitorName.isEmpty()) + return; + } + } + + // 如果没有找到有效的监视器名称,设置默认值 + if (m_MonitorName.isEmpty()) + m_MonitorName = "Unknown Monitor"; +} + QString EDIDParser::binToDec(QString strBin) //二进制转十进制 { // 二进制转十进制 diff --git a/deepin-devicemanager/src/Tool/EDIDParser.h b/deepin-devicemanager/src/Tool/EDIDParser.h index 0f7118f55..abc538d15 100644 --- a/deepin-devicemanager/src/Tool/EDIDParser.h +++ b/deepin-devicemanager/src/Tool/EDIDParser.h @@ -52,6 +52,12 @@ class EDIDParser */ const QString &screenSize()const; + /** + * @brief screenSize:获取监视器名称 + * @return 监视器名称 + */ + const QString &monitorName()const; + /** * @brief width : get screen width * @return @@ -81,6 +87,11 @@ class EDIDParser */ void parseScreenSize(); + /** + * @brief parseScreenSize:从edid中获取监视器名称 + */ + void parseMonitorName(); + /** * @brief binToDec:将二进制转换成十进制 * @param strBin:二进制字符串 @@ -140,6 +151,7 @@ class EDIDParser QString m_Model; // 显示屏的型号信息 QString m_ReleaseDate; // 显示屏的生产日期 QString m_ScreenSize; // 屏幕大小 + QString m_MonitorName; // 监视器名称 bool m_LittleEndianMode; // 小端模式 int m_Width; // width int m_Height; // heigth diff --git a/deepin-devicemanager/src/Tool/commontools.cpp b/deepin-devicemanager/src/Tool/commontools.cpp index 2cf89c6e7..dcebeec70 100644 --- a/deepin-devicemanager/src/Tool/commontools.cpp +++ b/deepin-devicemanager/src/Tool/commontools.cpp @@ -167,45 +167,83 @@ QString CommonTools::getBackupPath() return "/usr/share/deepin-devicemanager/"; } -void CommonTools::parseEDID(const QStringList &allEDIDS, const QString &input) +void CommonTools::parseEDID(const QStringList &allEDIDS, const QString &input, bool isHW) { for (auto edid:allEDIDS) { - QProcess process; - process.start(QString("hexdump %1").arg(edid)); - process.waitForFinished(-1); + QString edidStr; + if (isHW) { + QProcess process; + process.start(QString("hexdump %1").arg(edid)); + process.waitForFinished(-1); - QString deviceInfo = process.readAllStandardOutput(); - if (deviceInfo.isEmpty()) - continue; + QString deviceInfo = process.readAllStandardOutput(); + if (deviceInfo.isEmpty()) + continue; - QString edidStr; - QStringList lines = deviceInfo.split("\n"); - for (auto line:lines) { - QStringList words = line.trimmed().split(" "); - if (words.size() != 9) + QStringList lines = deviceInfo.split("\n"); + for (auto line:lines) { + QStringList words = line.trimmed().split(" "); + if (words.size() != 9) + continue; + + words.removeAt(0); + QString l = words.join(""); + l.append("\n"); + edidStr.append(l); + } + } else { + QProcess process; + process.start(QString("hexdump -C %1").arg(edid)); + process.waitForFinished(-1); + QString deviceInfo = process.readAllStandardOutput(); + if (deviceInfo.isEmpty()) continue; - words.removeAt(0); - QString l = words.join(""); - l.append("\n"); - edidStr.append(l); + QStringList lines = deviceInfo.split("\n"); + for (auto line: lines) { + if (line.trimmed().isEmpty()) + continue; + int firstSpace = line.indexOf(" "); + int lastPipe = line.indexOf("|"); + + if (firstSpace == -1 || lastPipe == -1 || firstSpace >= lastPipe) + continue; + + QString hexPart = line.mid(firstSpace + 2, lastPipe - firstSpace -3).trimmed(); + + QStringList hexBytes = hexPart.split(QRegExp("\\s+")); + + QString lineData; + for (const QString &hexByte : hexBytes) { + if (hexByte.length() == 2 && hexByte != "") + lineData.append(hexByte); + } + + if (lineData.length() == 32) + edidStr.append(lineData + "\n"); + } } - lines = edidStr.split("\n"); + QStringList lines = edidStr.split("\n"); if (lines.size() > 3){ EDIDParser edidParser; QString errorMsg; - edidParser.setEdid(edidStr,errorMsg,"\n", false); + edidParser.setEdid(edidStr,errorMsg,"\n", isHW ? false : true); QMap mapInfo; mapInfo.insert("Vendor",edidParser.vendor()); - mapInfo.insert("Model",edidParser.model()); - //mapInfo.insert("Date",edidParser.releaseDate()); + if (isHW) + mapInfo.insert("Model",edidParser.model()); + else + mapInfo.insert("Model",edidParser.monitorName()); mapInfo.insert("Size",edidParser.screenSize()); mapInfo.insert("Display Input",input); DeviceMonitor *device = new DeviceMonitor(); - device->setInfoFromEdid(mapInfo); + if (isHW) + device->setInfoFromEdid(mapInfo); + else + device->setInfoFromEdidForCustom(mapInfo); DeviceManager::instance()->addMonitor(device); } } diff --git a/deepin-devicemanager/src/Tool/commontools.h b/deepin-devicemanager/src/Tool/commontools.h index 71b2bc890..96ec149a5 100644 --- a/deepin-devicemanager/src/Tool/commontools.h +++ b/deepin-devicemanager/src/Tool/commontools.h @@ -78,7 +78,7 @@ class CommonTools : public QObject */ static QString getBackupPath(); - static void parseEDID(const QStringList &allEDIDS, const QString &input); + static void parseEDID(const QStringList &allEDIDS, const QString &input, bool isHW = true); static QString getGpuInfoCommandFromDConfig(); signals: From dabc018f6903ae6e97e11ba844946ac473d36283 Mon Sep 17 00:00:00 2001 From: gongheng Date: Wed, 30 Jul 2025 13:09:48 +0800 Subject: [PATCH 64/69] fix: [cppcheck] Remove the useless code. -- The "ret" is not use, so remvoe it. --- .../src/DeviceManager/DeviceAudio.cpp | 12 +++++----- .../src/DeviceManager/DeviceBios.cpp | 4 ++-- .../src/DeviceManager/DeviceBluetooth.cpp | 22 +++++++++---------- .../src/DeviceManager/DeviceCdrom.cpp | 8 +++---- .../src/DeviceManager/DeviceInfo.cpp | 4 ++-- 5 files changed, 25 insertions(+), 25 deletions(-) diff --git a/deepin-devicemanager/src/DeviceManager/DeviceAudio.cpp b/deepin-devicemanager/src/DeviceManager/DeviceAudio.cpp index 8f1020094..54c110e81 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceAudio.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceAudio.cpp @@ -119,14 +119,14 @@ bool DeviceAudio::setInfoFromLshw(const QMap &mapInfo) TomlFixMethod DeviceAudio::setInfoFromTomlOneByOne(const QMap &mapInfo) { TomlFixMethod ret = TOML_None; -// must cover the loadOtherDeviceInfo + // must cover the loadOtherDeviceInfo // 添加基本信息 - ret = setTomlAttribute(mapInfo, "SysFS_Path", m_SysPath); - ret = setTomlAttribute(mapInfo, "KernelModeDriver", m_Driver); + setTomlAttribute(mapInfo, "SysFS_Path", m_SysPath); + setTomlAttribute(mapInfo, "KernelModeDriver", m_Driver); // 添加其他信息,成员变量 - ret = setTomlAttribute(mapInfo, "Chip", m_Chip); - ret = setTomlAttribute(mapInfo, "Capabilities", m_Capabilities); - ret = setTomlAttribute(mapInfo, "Memory Address", m_Memory); + setTomlAttribute(mapInfo, "Chip", m_Chip); + setTomlAttribute(mapInfo, "Capabilities", m_Capabilities); + setTomlAttribute(mapInfo, "Memory Address", m_Memory); ret = setTomlAttribute(mapInfo, "IRQ", m_Irq); //3. 获取设备的其它信息 getOtherMapInfo(mapInfo); diff --git a/deepin-devicemanager/src/DeviceManager/DeviceBios.cpp b/deepin-devicemanager/src/DeviceManager/DeviceBios.cpp index 5b74f1a34..92fbd0ab7 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceBios.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceBios.cpp @@ -23,8 +23,8 @@ TomlFixMethod DeviceBios::setInfoFromTomlOneByOne(const QMap & TomlFixMethod ret = TOML_None; ret = setTomlAttribute(mapInfo, "Version", m_Version, true); - ret = setTomlAttribute(mapInfo, "Product Name", m_ProductName, true); - ret = setTomlAttribute(mapInfo, "Chipset", m_ChipsetFamily, true); + setTomlAttribute(mapInfo, "Product Name", m_ProductName, true); + setTomlAttribute(mapInfo, "Chipset", m_ChipsetFamily, true); // ret = setTomlAttribute(mapInfo, "Vendor", m_Vendor,true); // m_IsBoard = true; diff --git a/deepin-devicemanager/src/DeviceManager/DeviceBluetooth.cpp b/deepin-devicemanager/src/DeviceManager/DeviceBluetooth.cpp index 3a5654d7c..7ab898171 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceBluetooth.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceBluetooth.cpp @@ -116,20 +116,20 @@ TomlFixMethod DeviceBluetooth::setInfoFromTomlOneByOne(const QMap &mapInfo) TomlFixMethod DeviceCdrom::setInfoFromTomlOneByOne(const QMap &mapInfo) { TomlFixMethod ret = TOML_None; - ret = setTomlAttribute(mapInfo, "Model", m_Type); - ret = setTomlAttribute(mapInfo, "Bus Info", m_BusInfo); - ret = setTomlAttribute(mapInfo, "Capabilities", m_Capabilities); - ret = setTomlAttribute(mapInfo, "Maximum Power", m_MaxPower); + setTomlAttribute(mapInfo, "Model", m_Type); + setTomlAttribute(mapInfo, "Bus Info", m_BusInfo); + setTomlAttribute(mapInfo, "Capabilities", m_Capabilities); + setTomlAttribute(mapInfo, "Maximum Power", m_MaxPower); ret = setTomlAttribute(mapInfo, "Speed", m_Speed); //3. 获取设备的其它信息 getOtherMapInfo(mapInfo); diff --git a/deepin-devicemanager/src/DeviceManager/DeviceInfo.cpp b/deepin-devicemanager/src/DeviceManager/DeviceInfo.cpp index 24f00a5a3..448fedaf0 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceInfo.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceInfo.cpp @@ -506,8 +506,8 @@ TomlFixMethod DeviceBaseInfo::setInfoFromTomlBase(const QMap & return TOML_Del; } - ret2 = setTomlAttribute(mapInfo, "Revision", m_Version); - ret2 = setTomlAttribute(mapInfo, "Description", m_Description); + setTomlAttribute(mapInfo, "Revision", m_Version); + setTomlAttribute(mapInfo, "Description", m_Description); m_VID = m_VID.toLower(); m_PID = m_PID.toLower(); m_VID_PID = m_VID + m_PID.remove("0x"); From 04d5c66a8f4fc4de8d05df32843b633a75af5763 Mon Sep 17 00:00:00 2001 From: gongheng Date: Wed, 30 Jul 2025 13:33:09 +0800 Subject: [PATCH 65/69] Perf: [cppcheck] Improve program execution efficiency. -- Enhance application runtime performance -- Clean up dead/unused code --- .../src/DeviceManager/DeviceManager.cpp | 51 ++++++++++--------- .../src/DeviceManager/DeviceMonitor.cpp | 2 - .../src/DeviceManager/DeviceStorage.cpp | 2 +- 3 files changed, 29 insertions(+), 26 deletions(-) diff --git a/deepin-devicemanager/src/DeviceManager/DeviceManager.cpp b/deepin-devicemanager/src/DeviceManager/DeviceManager.cpp index ab0542521..e874c2613 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceManager.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceManager.cpp @@ -36,7 +36,7 @@ using namespace DDLog; DeviceManager *DeviceManager::sInstance = nullptr; int DeviceManager::m_CurrentXlsRow = 1; -QMutex addCmdMutex; +static QMutex addCmdMutex; DeviceManager::DeviceManager() : m_CpuNum(1) @@ -359,11 +359,13 @@ QList DeviceManager::convertDeviceList(DeviceType deviceType) if (deviceType == DT_Print) {return m_ListDevicePrint;} if (deviceType == DT_Image) {return m_ListDeviceImage;} if (deviceType == DT_Others) {return m_ListDeviceOthers;} + + return QList(); } DeviceBaseInfo *DeviceManager::createDevice(DeviceType deviceType) { - DeviceBaseInfo *vTemp; + DeviceBaseInfo *vTemp { nullptr }; if (deviceType == DT_Computer) {vTemp = new DeviceComputer(); return vTemp;} if (deviceType == DT_Cpu) {vTemp = new DeviceCpu(); return vTemp;} if (deviceType == DT_Bios) {vTemp = new DeviceBios(); return vTemp;} @@ -467,7 +469,6 @@ TomlFixMethod DeviceManager::tomlDeviceMapSet(DeviceType deviceType, DeviceBase DevicePower *tomldevice = dynamic_cast(device); (TOML_Del == tomldevice->setInfoFromTomlBase(mapInfo)) ? ret = TOML_Del : ret = tomldevice->setInfoFromTomlOneByOne(mapInfo); } break; - default: { } break; } return ret; } @@ -477,83 +478,81 @@ QString DeviceManager::tomlDeviceReadKeyValue(DeviceType deviceType, DeviceBaseI if (!device) return QString(""); - TomlFixMethod ret = TOML_None; switch (deviceType) { case DT_Null: break; case DT_Computer: { DeviceComputer *tomldevice = dynamic_cast(device); return tomldevice->readDeviceInfoKeyValue(key); - } break; + }; case DT_Cpu: { DeviceCpu *tomldevice = dynamic_cast(device); return tomldevice->readDeviceInfoKeyValue(key); - } break; + }; case DT_Bios: { DeviceBios *tomldevice = dynamic_cast(device); return tomldevice->readDeviceInfoKeyValue(key); - } break; + }; case DT_Memory: { DeviceMemory *tomldevice = dynamic_cast(device); return tomldevice->readDeviceInfoKeyValue(key); - } break; + }; case DT_Storage: { DeviceStorage *tomldevice = dynamic_cast(device); return tomldevice->readDeviceInfoKeyValue(key); - } break; + }; case DT_Gpu: { DeviceGpu *tomldevice = dynamic_cast(device); return tomldevice->readDeviceInfoKeyValue(key); - } break; + }; case DT_Monitor: { DeviceMonitor *tomldevice = dynamic_cast(device); return tomldevice->readDeviceInfoKeyValue(key); - } break; + }; case DT_Network: { DeviceNetwork *tomldevice = dynamic_cast(device); return tomldevice->readDeviceInfoKeyValue(key); - } break; + }; case DT_Audio: { DeviceAudio *tomldevice = dynamic_cast(device); return tomldevice->readDeviceInfoKeyValue(key); - } break; + }; case DT_Bluetoorh: { DeviceBluetooth *tomldevice = dynamic_cast(device); return tomldevice->readDeviceInfoKeyValue(key); - } break; + }; case DT_Keyboard: { DeviceInput *tomldevice = dynamic_cast(device); return tomldevice->readDeviceInfoKeyValue(key); - } break; + }; case DT_Mouse: { DeviceInput *tomldevice = dynamic_cast(device); return tomldevice->readDeviceInfoKeyValue(key); - } break; + }; case DT_Print: { DevicePrint *tomldevice = dynamic_cast(device); return tomldevice->readDeviceInfoKeyValue(key); - } break; + }; case DT_Image: { DeviceImage *tomldevice = dynamic_cast(device); return tomldevice->readDeviceInfoKeyValue(key); - } break; + }; case DT_Cdrom: { DeviceCdrom *tomldevice = dynamic_cast(device); return tomldevice->readDeviceInfoKeyValue(key); - } break; + }; case DT_Others: { DeviceOthers *tomldevice = dynamic_cast(device); return tomldevice->readDeviceInfoKeyValue(key); - } break; + }; case DT_OtherPCI: { DeviceOtherPCI *tomldevice = dynamic_cast(device); return tomldevice->readDeviceInfoKeyValue(key); - } break; + }; case DT_Power: { DevicePower *tomldevice = dynamic_cast(device); return tomldevice->readDeviceInfoKeyValue(key); - } break; - default: { } break; + }; } return QString(""); } @@ -561,6 +560,8 @@ QString DeviceManager::tomlDeviceReadKeyValue(DeviceType deviceType, DeviceBaseI bool DeviceManager::tomlSetBytomlmatchkey(DeviceType deviceType, DeviceBaseInfo *device, const QString &tomltomlmatchkey, const QString &tomltomlconfigdemanding) { Q_UNUSED(deviceType) + Q_UNUSED(tomltomlconfigdemanding) + QMap itemMap; QStringList keyValues = tomltomlmatchkey.split(","); foreach (const QString &keyValue, keyValues) { @@ -690,6 +691,8 @@ void DeviceManager::tomlDeviceAdd(DeviceType deviceType, DeviceBaseInfo *const d bool DeviceManager::findByModalias(DeviceType deviceType, DeviceBaseInfo *device, const QString &modalias) { + Q_UNUSED(deviceType) + if (modalias.isEmpty()) return false; { @@ -718,6 +721,8 @@ bool DeviceManager::findByModalias(DeviceType deviceType, DeviceBaseInfo *device bool DeviceManager::findByVIDPID(DeviceType deviceType, DeviceBaseInfo *device, const QString &vid, const QString &pid) { + Q_UNUSED(deviceType) + if (vid.isEmpty() || pid.isEmpty()) return false; { diff --git a/deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp b/deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp index 1c1ea6811..4bc976a25 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp @@ -288,8 +288,6 @@ QString DeviceMonitor::subTitle() const QString DeviceMonitor::getOverviewInfo() { QString ov; - - ov = QString("%1(%2)").arg(m_Name).arg(m_ScreenSize); if (Common::specialComType == 6 || Common::specialComType == 7) { ov = QString("(%1)").arg(m_ScreenSize); } else { diff --git a/deepin-devicemanager/src/DeviceManager/DeviceStorage.cpp b/deepin-devicemanager/src/DeviceManager/DeviceStorage.cpp index 0c0d88e4a..dfd91d3f7 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceStorage.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceStorage.cpp @@ -532,7 +532,7 @@ QString DeviceStorage::subTitle() const QString DeviceStorage::getOverviewInfo() { - QString overViewInfo = QString("%1 (%2)").arg(m_Name).arg(m_Size); + QString overViewInfo; if (m_Interface.contains("UFS", Qt::CaseInsensitive)) { overViewInfo = QString("%1 %2").arg(m_Size).arg("UFS"); From 6961768934170f0dfe32904f5ae30bd6001820f5 Mon Sep 17 00:00:00 2001 From: gongheng Date: Fri, 1 Aug 2025 09:23:39 +0800 Subject: [PATCH 66/69] fix: [Net-Wakeup] The net card can not wakeup. -- Code Logic error, "sizeof(logicalName::toStdString().c_str())" always return 8, not the length of logicalName. -- So, When the length more than 8, the net card will can not find. Log: fix issue Bug: https://pms.uniontech.com/bug-view-326565.html --- .../src/wakecontrol/wakeuputils.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/deepin-devicemanager-server/deepin-devicecontrol/src/wakecontrol/wakeuputils.cpp b/deepin-devicemanager-server/deepin-devicecontrol/src/wakecontrol/wakeuputils.cpp index 186c7ba39..d3a9ad613 100644 --- a/deepin-devicemanager-server/deepin-devicecontrol/src/wakecontrol/wakeuputils.cpp +++ b/deepin-devicemanager-server/deepin-devicecontrol/src/wakecontrol/wakeuputils.cpp @@ -117,7 +117,12 @@ WakeupUtils::EthStatus WakeupUtils::wakeOnLanIsOpen(const QString &logicalName) struct ifreq ifr; struct ethtool_wolinfo wolinfo; memset(&ifr, 0, sizeof(ifr)); - strncpy(ifr.ifr_name, logicalName.toStdString().c_str(), sizeof(logicalName.toStdString().c_str())); + memset(&wolinfo, 0, sizeof(wolinfo)); + + QByteArray nameBytes = logicalName.toLocal8Bit(); + strncpy(ifr.ifr_name, nameBytes.constData(), IFNAMSIZ - 1); + ifr.ifr_name[IFNAMSIZ - 1] = '\0'; + wolinfo.cmd = ETHTOOL_GWOL; ifr.ifr_data = reinterpret_cast(&wolinfo); if (0 != ioctl(fd, SIOCETHTOOL, &ifr)) { @@ -147,7 +152,12 @@ bool WakeupUtils::setWakeOnLan(const QString &logicalName, bool open) struct ifreq ifr; struct ethtool_wolinfo wolinfo; memset(&ifr, 0, sizeof(ifr)); - strncpy(ifr.ifr_name, logicalName.toStdString().c_str(), sizeof(logicalName.toStdString().c_str())); + memset(&wolinfo, 0, sizeof(wolinfo)); + + QByteArray nameBytes = logicalName.toLocal8Bit(); + strncpy(ifr.ifr_name, nameBytes.constData(), IFNAMSIZ - 1); + ifr.ifr_name[IFNAMSIZ - 1] = '\0'; + wolinfo.cmd = ETHTOOL_SWOL; if (open) wolinfo.wolopts = 0 | WAKE_MAGIC; From bcee01b4b6d3751ada3ac7f763fa75f08ac5fa82 Mon Sep 17 00:00:00 2001 From: gongheng Date: Tue, 5 Aug 2025 15:20:24 +0800 Subject: [PATCH 67/69] Perf: Improve program performance -- Function parameter should be passed by const reference. --- .../src/DriverControl/DBusDriverInterface.cpp | 6 +++--- .../src/DriverControl/DBusDriverInterface.h | 6 +++--- deepin-devicemanager/src/DriverControl/DriverScanner.cpp | 2 +- deepin-devicemanager/src/DriverControl/DriverScanner.h | 2 +- deepin-devicemanager/src/GenerateDevice/CmdTool.cpp | 2 +- deepin-devicemanager/src/GenerateDevice/CmdTool.h | 2 +- deepin-devicemanager/src/GenerateDevice/GetInfoPool.cpp | 2 +- deepin-devicemanager/src/GenerateDevice/GetInfoPool.h | 2 +- deepin-devicemanager/src/Page/MainWindow.cpp | 2 +- deepin-devicemanager/src/Page/MainWindow.h | 2 +- 10 files changed, 14 insertions(+), 14 deletions(-) diff --git a/deepin-devicemanager/src/DriverControl/DBusDriverInterface.cpp b/deepin-devicemanager/src/DriverControl/DBusDriverInterface.cpp index 5948f8c62..62b55faec 100644 --- a/deepin-devicemanager/src/DriverControl/DBusDriverInterface.cpp +++ b/deepin-devicemanager/src/DriverControl/DBusDriverInterface.cpp @@ -113,12 +113,12 @@ DBusDriverInterface::~DBusDriverInterface() } -void DBusDriverInterface::slotProcessChange(qint32 value, QString detail) +void DBusDriverInterface::slotProcessChange(qint32 value, const QString &detail) { emit processChange(value, detail); } -void DBusDriverInterface::slotProcessEnd(bool success, QString msg) +void DBusDriverInterface::slotProcessEnd(bool success, const QString &msg) { if (success) { emit processChange(100, ""); @@ -133,7 +133,7 @@ void DBusDriverInterface::slotCallFinished(QDBusPendingCallWatcher *watcher) watcher->deleteLater(); } -void DBusDriverInterface::slotDownloadProgressChanged(QStringList msg) +void DBusDriverInterface::slotDownloadProgressChanged(const QStringList &msg) { emit downloadProgressChanged(msg); } diff --git a/deepin-devicemanager/src/DriverControl/DBusDriverInterface.h b/deepin-devicemanager/src/DriverControl/DBusDriverInterface.h index bd221158e..709b32f70 100644 --- a/deepin-devicemanager/src/DriverControl/DBusDriverInterface.h +++ b/deepin-devicemanager/src/DriverControl/DBusDriverInterface.h @@ -123,13 +123,13 @@ private slots: * @param value 当前处理的进度 * @param detail 发送过来的时时信息 */ - void slotProcessChange(qint32 value, QString detail); + void slotProcessChange(qint32 value, const QString &detail); /** * @brief slotProcessEnd 接收后台结束信号 * @param success */ - void slotProcessEnd(bool success, QString msg); + void slotProcessEnd(bool success, const QString &msg); /** * @brief slotCallFinished 更新结束结束的回调 @@ -139,7 +139,7 @@ private slots: /** * @brief slotDownloadProgressChanged 驱动下载时回调,返回驱动下载进度、速度、已下载大小信息 */ - void slotDownloadProgressChanged(QStringList msg); + void slotDownloadProgressChanged(const QStringList &msg); /** * @brief slotDownloadFinished 驱动下载完成 diff --git a/deepin-devicemanager/src/DriverControl/DriverScanner.cpp b/deepin-devicemanager/src/DriverControl/DriverScanner.cpp index 76fc09026..e3ec41d40 100644 --- a/deepin-devicemanager/src/DriverControl/DriverScanner.cpp +++ b/deepin-devicemanager/src/DriverControl/DriverScanner.cpp @@ -81,7 +81,7 @@ void DriverScanner::run() // emit scanFinished(SR_SUCESS); } -void DriverScanner::setDriverList(QList lstInfo) +void DriverScanner::setDriverList(const QList &lstInfo) { m_ListDriverInfo = lstInfo; m_IsStop = false; diff --git a/deepin-devicemanager/src/DriverControl/DriverScanner.h b/deepin-devicemanager/src/DriverControl/DriverScanner.h index ae1d7ddce..7439cba3b 100644 --- a/deepin-devicemanager/src/DriverControl/DriverScanner.h +++ b/deepin-devicemanager/src/DriverControl/DriverScanner.h @@ -25,7 +25,7 @@ class DriverScanner : public QThread * @brief setDriverList * @param lstInfo */ - void setDriverList(QList lstInfo); + void setDriverList(const QList &lstInfo); signals: void scanInfo(const QString &info, int progress); diff --git a/deepin-devicemanager/src/GenerateDevice/CmdTool.cpp b/deepin-devicemanager/src/GenerateDevice/CmdTool.cpp index 1679baa77..19641534c 100644 --- a/deepin-devicemanager/src/GenerateDevice/CmdTool.cpp +++ b/deepin-devicemanager/src/GenerateDevice/CmdTool.cpp @@ -184,7 +184,7 @@ QString CmdTool::loadOemTomlFileName(const QMap &mapInfo) return QString(); } -bool CmdTool::parseOemTomlInfo(const QString filename) +bool CmdTool::parseOemTomlInfo(const QString &filename) { bool tomlFileRead = false; bool tomlPars = false; diff --git a/deepin-devicemanager/src/GenerateDevice/CmdTool.h b/deepin-devicemanager/src/GenerateDevice/CmdTool.h index f838f9d81..61ceb888a 100644 --- a/deepin-devicemanager/src/GenerateDevice/CmdTool.h +++ b/deepin-devicemanager/src/GenerateDevice/CmdTool.h @@ -61,7 +61,7 @@ class CmdTool /** * @brief parseOemTomlInfo: 解析并加载厂商适配信息 */ - bool parseOemTomlInfo(const QString filename); + bool parseOemTomlInfo(const QString &filename); private: diff --git a/deepin-devicemanager/src/GenerateDevice/GetInfoPool.cpp b/deepin-devicemanager/src/GenerateDevice/GetInfoPool.cpp index 1204c0131..33645eb0c 100644 --- a/deepin-devicemanager/src/GenerateDevice/GetInfoPool.cpp +++ b/deepin-devicemanager/src/GenerateDevice/GetInfoPool.cpp @@ -12,7 +12,7 @@ static QMutex mutex; -CmdTask::CmdTask(QString key, QString file, QString info, GetInfoPool *parent) +CmdTask::CmdTask(const QString &key, const QString &file, const QString &info, GetInfoPool *parent) : m_Key(key) , m_File(file) , m_Info(info) diff --git a/deepin-devicemanager/src/GenerateDevice/GetInfoPool.h b/deepin-devicemanager/src/GenerateDevice/GetInfoPool.h index 4582b1f8b..8efb8679e 100644 --- a/deepin-devicemanager/src/GenerateDevice/GetInfoPool.h +++ b/deepin-devicemanager/src/GenerateDevice/GetInfoPool.h @@ -19,7 +19,7 @@ class CmdTask: public QObject, public QRunnable { Q_OBJECT public: - CmdTask(QString key, QString file, QString info, GetInfoPool *parent); + CmdTask(const QString &key, const QString &file, const QString &info, GetInfoPool *parent); ~CmdTask(); protected: void run() override; diff --git a/deepin-devicemanager/src/Page/MainWindow.cpp b/deepin-devicemanager/src/Page/MainWindow.cpp index 6a932a226..3249cc747 100644 --- a/deepin-devicemanager/src/Page/MainWindow.cpp +++ b/deepin-devicemanager/src/Page/MainWindow.cpp @@ -474,7 +474,7 @@ void MainWindow::refreshDataBase() } } -void MainWindow::slotSetPage(QString page) +void MainWindow::slotSetPage(const QString &page) { if ("driver" == page) { if (m_IsFirstRefresh) { diff --git a/deepin-devicemanager/src/Page/MainWindow.h b/deepin-devicemanager/src/Page/MainWindow.h index 2dcd93f72..6a60c8fd7 100644 --- a/deepin-devicemanager/src/Page/MainWindow.h +++ b/deepin-devicemanager/src/Page/MainWindow.h @@ -134,7 +134,7 @@ private slots: * @brief slotSetPage * @param page */ - void slotSetPage(QString page); + void slotSetPage(const QString &page); /** * @brief loadingFinishSlot:加载设备信息结束 槽 From 5e5dff5b58568b141462fbdb7701a87ddd86c5bb Mon Sep 17 00:00:00 2001 From: gongheng Date: Tue, 5 Aug 2025 15:23:06 +0800 Subject: [PATCH 68/69] Perf: Improve program performance -- Local varible item shadows outer variable -- Class has a constructor with 1 argument that is not explicit. --- deepin-devicemanager/src/GenerateDevice/CmdTool.cpp | 4 ++-- deepin-devicemanager/src/GenerateDevice/CustomGenerator.h | 2 +- deepin-devicemanager/src/GenerateDevice/GenerateDevicePool.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/deepin-devicemanager/src/GenerateDevice/CmdTool.cpp b/deepin-devicemanager/src/GenerateDevice/CmdTool.cpp index 19641534c..529e43a55 100644 --- a/deepin-devicemanager/src/GenerateDevice/CmdTool.cpp +++ b/deepin-devicemanager/src/GenerateDevice/CmdTool.cpp @@ -969,9 +969,9 @@ void CmdTool::loadNvidiaSettingInfo(const QString &key, const QString &debugfile QRegExp reg("[\\s\\S]*VideoRam[\\s\\S]*([0-9]{4,})[\\s\\S]*"); QStringList list = deviceInfo.split("\n"); - foreach (QString item, list) { + foreach (QString tmpInfo, list) { // Attribute 'VideoRam' (jixiaomei-PC:0.0): 2097152. 正则表达式获取2097152 - if (reg.exactMatch(item)) { + if (reg.exactMatch(tmpInfo)) { QString gpuSize = reg.cap(1); int numSize = gpuSize.toInt(); numSize /= 1024; diff --git a/deepin-devicemanager/src/GenerateDevice/CustomGenerator.h b/deepin-devicemanager/src/GenerateDevice/CustomGenerator.h index 9901d2ad4..4ef8f2422 100644 --- a/deepin-devicemanager/src/GenerateDevice/CustomGenerator.h +++ b/deepin-devicemanager/src/GenerateDevice/CustomGenerator.h @@ -11,7 +11,7 @@ class CustomGenerator : public DeviceGenerator { public: - CustomGenerator(QObject *parent = nullptr); + explicit CustomGenerator(QObject *parent = nullptr); /** * @brief generatorGpuDevice:生成显卡信息 diff --git a/deepin-devicemanager/src/GenerateDevice/GenerateDevicePool.h b/deepin-devicemanager/src/GenerateDevice/GenerateDevicePool.h index 7fe9d03e4..1de9195dc 100644 --- a/deepin-devicemanager/src/GenerateDevice/GenerateDevicePool.h +++ b/deepin-devicemanager/src/GenerateDevice/GenerateDevicePool.h @@ -45,7 +45,7 @@ class GenerateTask: public QObject, public QRunnable Q_OBJECT public: - GenerateTask(DeviceType deviceType); + explicit GenerateTask(DeviceType deviceType); ~GenerateTask(); signals: void finished(const QStringList &lst); From f9659490d86292ae9079cb8a7f347295d7cc8f3b Mon Sep 17 00:00:00 2001 From: gongheng Date: Tue, 5 Aug 2025 15:59:08 +0800 Subject: [PATCH 69/69] Chore: Fix the cppcheck warning. -- A destructor but is not marked 'override'. -- When dealing with inheritance, deleting a derived class object through a base class pointer without a virtual destructor will lead to problems. --- deepin-devicemanager/src/GenerateDevice/GetInfoPool.h | 2 +- deepin-devicemanager/src/GenerateDevice/LoadInfoThread.h | 2 +- deepin-devicemanager/src/Page/DeviceWidget.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/deepin-devicemanager/src/GenerateDevice/GetInfoPool.h b/deepin-devicemanager/src/GenerateDevice/GetInfoPool.h index 8efb8679e..c207baa6c 100644 --- a/deepin-devicemanager/src/GenerateDevice/GetInfoPool.h +++ b/deepin-devicemanager/src/GenerateDevice/GetInfoPool.h @@ -20,7 +20,7 @@ class CmdTask: public QObject, public QRunnable Q_OBJECT public: CmdTask(const QString &key, const QString &file, const QString &info, GetInfoPool *parent); - ~CmdTask(); + ~CmdTask() override; protected: void run() override; diff --git a/deepin-devicemanager/src/GenerateDevice/LoadInfoThread.h b/deepin-devicemanager/src/GenerateDevice/LoadInfoThread.h index 051468d94..440f285b0 100644 --- a/deepin-devicemanager/src/GenerateDevice/LoadInfoThread.h +++ b/deepin-devicemanager/src/GenerateDevice/LoadInfoThread.h @@ -16,7 +16,7 @@ class LoadInfoThread : public QThread Q_OBJECT public: LoadInfoThread(); - ~LoadInfoThread(); + ~LoadInfoThread() override; /** * @brief setFramework:设置架构 diff --git a/deepin-devicemanager/src/Page/DeviceWidget.h b/deepin-devicemanager/src/Page/DeviceWidget.h index 4a79f5c26..586cf400f 100644 --- a/deepin-devicemanager/src/Page/DeviceWidget.h +++ b/deepin-devicemanager/src/Page/DeviceWidget.h @@ -26,7 +26,7 @@ class DeviceWidget : public DWidget Q_OBJECT public: explicit DeviceWidget(QWidget *parent = nullptr); - ~DeviceWidget(); + ~DeviceWidget() override; /** * @brief updateListView:更新ListView