From f8ff496859d5803c0a3c54c3eb3f2c238cd2f297 Mon Sep 17 00:00:00 2001 From: shuaijie Date: Mon, 25 Nov 2024 22:02:33 +0800 Subject: [PATCH] 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 | 149 +- .../src/DeviceManager/DeviceBluetooth.cpp | 86 +- .../src/DeviceManager/DeviceCdrom.cpp | 50 +- .../src/DeviceManager/DeviceComputer.cpp | 2 +- .../src/DeviceManager/DeviceCpu.cpp | 67 +- .../src/DeviceManager/DeviceGpu.cpp | 85 +- .../src/DeviceManager/DeviceGpu.h | 2 +- .../src/DeviceManager/DeviceImage.cpp | 24 +- .../src/DeviceManager/DeviceInfo.cpp | 179 +- .../src/DeviceManager/DeviceInfo.h | 45 +- .../src/DeviceManager/DeviceInput.cpp | 92 +- .../src/DeviceManager/DeviceInput.h | 6 - .../src/DeviceManager/DeviceManager.cpp | 111 +- .../src/DeviceManager/DeviceManager.h | 12 +- .../src/DeviceManager/DeviceMemory.cpp | 78 +- .../src/DeviceManager/DeviceMonitor.cpp | 43 +- .../src/DeviceManager/DeviceMonitor.h | 15 +- .../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 | 155 +- .../src/DeviceManager/DeviceStorage.h | 15 - .../src/GenerateDevice/CmdTool.cpp | 9 +- .../src/GenerateDevice/DeviceFactory.cpp | 6 +- .../src/GenerateDevice/DeviceGenerator.cpp | 88 +- .../src/GenerateDevice/HWGenerator.cpp | 344 +- .../src/GenerateDevice/HWGenerator.h | 40 +- .../src/GenerateDevice/KLUGenerator.cpp | 218 - .../src/GenerateDevice/KLUGenerator.h | 36 - .../src/GenerateDevice/KLVGenerator.cpp | 285 -- .../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/commondefine.h | 29 + deepin-devicemanager/src/commonfunction.cpp | 20 + deepin-devicemanager/src/commonfunction.h | 3 +- .../src/DeviceManager/ut_deviceinput.cpp | 40 - .../src/DeviceManager/ut_devicemanager.cpp | 13 - .../src/DeviceManager/ut_devicemonitor.cpp | 15 - .../src/DeviceManager/ut_devicenetwork.cpp | 4 +- .../src/DeviceManager/ut_devicestorage.cpp | 78 - .../src/GenerateDevice/ut_klugenerator.cpp | 2 - .../deepin-devicemanager_zh_CN.ts | 4464 +++++++---------- 51 files changed, 2962 insertions(+), 4357 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 643fdde6a..e35d3241d 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceAudio.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceAudio.cpp @@ -368,22 +368,22 @@ void DeviceAudio::initFilterKey() { qCDebug(appLog) << "DeviceAudio::initFilterKey called."; // 添加可显示的属性 - 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"); qCDebug(appLog) << "Filter keys initialized."; } @@ -391,12 +391,12 @@ void DeviceAudio::loadBaseDeviceInfo() { qCDebug(appLog) << "DeviceAudio::loadBaseDeviceInfo called."; // 添加基本信息 - 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); qCDebug(appLog) << "Base device info loaded."; } @@ -404,12 +404,12 @@ void DeviceAudio::loadOtherDeviceInfo() { qCDebug(appLog) << "DeviceAudio::loadOtherDeviceInfo called."; // 添加其他信息,成员变量 - 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(); qCDebug(appLog) << "Other device info loaded."; @@ -419,8 +419,8 @@ void DeviceAudio::loadTableHeader() { qCDebug(appLog) << "DeviceAudio::loadTableHeader called."; // 表头信息 - m_TableHeader.append(tr("Name")); - m_TableHeader.append(tr("Vendor")); + m_TableHeader.append("Name"); + m_TableHeader.append("Vendor"); qCDebug(appLog) << "Table header loaded."; } diff --git a/deepin-devicemanager/src/DeviceManager/DeviceBios.cpp b/deepin-devicemanager/src/DeviceManager/DeviceBios.cpp index 782bb1bef..430c98f56 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceBios.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceBios.cpp @@ -50,8 +50,8 @@ bool DeviceBios::setBiosInfo(const QMap &mapInfo) } // 获取BIOS信息 - m_Name = QObject::tr("BIOS Information"); - m_tomlName = ("BIOS Information"); + m_Name = "BIOS Information"; + m_tomlName = "BIOS Information"; setAttribute(mapInfo, "Vendor", m_Vendor); setAttribute(mapInfo, "Version", m_Version); qCDebug(appLog) << "BIOS info attributes set."; @@ -79,8 +79,8 @@ bool DeviceBios::setBaseBoardInfo(const QMap &mapInfo) } // 获取主板信息 - m_Name = QObject::tr("Base Board Information"); - m_tomlName = ("Base Board Information"); + m_Name = "Base Board Information"; + m_tomlName = "Base Board Information"; setAttribute(mapInfo, "Manufacturer", m_Vendor); setAttribute(mapInfo, "Version", m_Version); setAttribute(mapInfo, "Product Name", m_ProductName); @@ -107,8 +107,8 @@ bool DeviceBios::setSystemInfo(const QMap &mapInfo) } // 获取系统信息 - m_Name = QObject::tr("System Information"); - m_tomlName = ("System Information"); + m_Name = "System Information"; + m_tomlName = "System Information"; setAttribute(mapInfo, "Manufacturer", m_Vendor); setAttribute(mapInfo, "Version", m_Version); qCDebug(appLog) << "System info attributes set."; @@ -128,8 +128,8 @@ bool DeviceBios::setChassisInfo(const QMap &mapInfo) } // 获取机箱信息 - m_Name = QObject::tr("Chassis Information"); - m_tomlName = ("Chassis Information"); + m_Name = "Chassis Information"; + m_tomlName = "Chassis Information"; setAttribute(mapInfo, "Manufacturer", m_Vendor); setAttribute(mapInfo, "Version", m_Version); qCDebug(appLog) << "Chassis info attributes set."; @@ -149,8 +149,8 @@ bool DeviceBios::setMemoryInfo(const QMap &mapInfo) } // 获取内存插槽信息 - m_Name = QObject::tr("Physical Memory Array"); - m_tomlName = ("Physical Memory Array"); + m_Name = "Physical Memory Array"; + m_tomlName = "Physical Memory Array"; setAttribute(mapInfo, "Manufacturer", m_Vendor); setAttribute(mapInfo, "Version", m_Version); qCDebug(appLog) << "Memory info attributes set."; @@ -200,7 +200,7 @@ bool DeviceBios::isBoard()const QString DeviceBios::subTitle() { // qCDebug(appLog) << "DeviceBios::subTitle called, returning: " << m_Name; - return m_Name; + return QObject::tr(m_Name.toLatin1());; } const QString DeviceBios::getOverviewInfo() @@ -222,67 +222,66 @@ void DeviceBios::initFilterKey() qCDebug(appLog) << "DeviceBios::initFilterKey called."; // 添加可显示属性 - 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"); qCDebug(appLog) << "Filter keys initialized."; } @@ -290,9 +289,9 @@ void DeviceBios::loadBaseDeviceInfo() { qCDebug(appLog) << "DeviceBios::loadBaseDeviceInfo called."; // 添加基本信息 - 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 3eda92690..17e5071fd 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceBluetooth.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceBluetooth.cpp @@ -248,34 +248,34 @@ void DeviceBluetooth::initFilterKey() { qCDebug(appLog) << "DeviceBluetooth::initFilterKey called."; // 添加可显示的属性 - 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"); qCDebug(appLog) << "Filter keys initialized."; } @@ -283,27 +283,27 @@ void DeviceBluetooth::loadBaseDeviceInfo() { qCDebug(appLog) << "DeviceBluetooth::loadBaseDeviceInfo called."; // 添加基本信息 - 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() { qCDebug(appLog) << "DeviceBluetooth::loadOtherDeviceInfo called."; // 添加其他信息,成员变量 - 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 865358ebc..0a8e01f02 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceCdrom.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceCdrom.cpp @@ -128,20 +128,20 @@ void DeviceCdrom::initFilterKey() { qCDebug(appLog) << "DeviceCdrom::initFilterKey called."; // 添加可显示的属性 - 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"); qCDebug(appLog) << "Filter keys initialized."; } @@ -149,23 +149,23 @@ void DeviceCdrom::loadBaseDeviceInfo() { qCDebug(appLog) << "DeviceCdrom::loadBaseDeviceInfo called."; // 添加基本信息 - 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); qCDebug(appLog) << "Base device info loaded."; } void DeviceCdrom::loadOtherDeviceInfo() { qCDebug(appLog) << "DeviceCdrom::loadOtherDeviceInfo called."; - 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(); qCDebug(appLog) << "Other device info loaded."; diff --git a/deepin-devicemanager/src/DeviceManager/DeviceComputer.cpp b/deepin-devicemanager/src/DeviceManager/DeviceComputer.cpp index 23f6fb5a6..3da5cc1fc 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceComputer.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceComputer.cpp @@ -198,7 +198,7 @@ void DeviceComputer::loadBaseDeviceInfo() { qCDebug(appLog) << "DeviceComputer::loadBaseDeviceInfo called."; // 添加基本信息 - 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 c738bd3e0..312ec219d 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceCpu.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceCpu.cpp @@ -64,11 +64,11 @@ void DeviceCpu::initFilterKey() { qCDebug(appLog) << "DeviceCpu::initFilterKey called."; // 添加可显示的属性 - addFilterKey(QObject::tr("CPU implementer")); - addFilterKey(QObject::tr("CPU architecture")); - addFilterKey(QObject::tr("CPU variant")); - addFilterKey(QObject::tr("CPU part")); - addFilterKey(QObject::tr("CPU revision")); + addFilterKey("CPU implementer"); + addFilterKey("CPU architecture"); + addFilterKey("CPU variant"); + addFilterKey("CPU part"); + addFilterKey("CPU revision"); qCDebug(appLog) << "Filter keys initialized."; } @@ -77,20 +77,19 @@ void DeviceCpu::loadBaseDeviceInfo() qCDebug(appLog) << "Start loading base CPU info"; // 添加基本信息 - addBaseDeviceInfo(tr("Name"), m_Name); - addBaseDeviceInfo(tr("Vendor"), m_Vendor); - addBaseDeviceInfo(tr("CPU ID"), m_PhysicalID); - addBaseDeviceInfo(tr("Core ID"), m_CoreID); - addBaseDeviceInfo(tr("Threads"), m_ThreadNum); + addBaseDeviceInfo("Name", m_Name); + addBaseDeviceInfo("Vendor", m_Vendor); + addBaseDeviceInfo("CPU ID", m_PhysicalID); + addBaseDeviceInfo("Core ID", m_CoreID); + addBaseDeviceInfo("Threads", m_ThreadNum); if (!m_FrequencyIsCur) { qCDebug(appLog) << "Frequency is not current, adding Max Speed."; - addBaseDeviceInfo(tr("Max Speed"), m_MaxFrequency); + addBaseDeviceInfo("Max Speed", m_MaxFrequency); } - addBaseDeviceInfo(tr("BogoMIPS"), m_BogoMIPS); - addBaseDeviceInfo(tr("Architecture"), m_Architecture); - addBaseDeviceInfo(tr("CPU Family"), m_Familly); - addBaseDeviceInfo(tr("Model"), m_Model); - qCDebug(appLog) << "Base device info loaded."; + addBaseDeviceInfo("BogoMIPS", m_BogoMIPS); + addBaseDeviceInfo("Architecture", m_Architecture); + addBaseDeviceInfo("CPU Family", m_Familly); + addBaseDeviceInfo("Model", m_Model); } const QString &DeviceCpu::vendor() const @@ -126,7 +125,7 @@ bool DeviceCpu::frequencyIsRange()const QString DeviceCpu::subTitle() { // qCDebug(appLog) << "DeviceCpu::subTitle called, returning: " << QString("%1 %2").arg(tr("Processor")).arg(m_PhysicalID); - return QString("%1 %2").arg(tr("Processor")).arg(m_PhysicalID); + return QString("%1 %2").arg(QObject::tr("Processor")).arg(m_PhysicalID); } const QString DeviceCpu::getOverviewInfo() @@ -139,9 +138,9 @@ const QString DeviceCpu::getOverviewInfo() QString ov = QString("%1 (%2%3 / %4%5)") \ .arg(m_Name) \ .arg(m_trNumber[m_CPUCoreNum]) \ - .arg(tr("Core(s)")) \ + .arg(QObject::tr("Core(s)")) \ .arg(m_trNumber[m_LogicalCPUNum]) \ - .arg(tr("Processor")); + .arg(QObject::tr("Processor")); qCDebug(appLog) << "Overview info: " << ov; qCDebug(appLog) << "DeviceCpu::getOverviewInfo finished."; return ov; @@ -266,8 +265,8 @@ TomlFixMethod DeviceCpu::setInfoFromTomlOneByOne(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); @@ -319,15 +318,15 @@ void DeviceCpu::loadOtherDeviceInfo() qCDebug(appLog) << "Loading other device info"; // 倒序,头插,保证原来的顺序 // 添加其他信息,成员变量 - 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(); @@ -338,10 +337,10 @@ void DeviceCpu::loadTableHeader() { qCDebug(appLog) << "Loading table header"; // 加载表头 - 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() ? tr("Frequency") : tr("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 43e18019c..99a6fa627 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceGpu.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceGpu.cpp @@ -42,21 +42,21 @@ void DeviceGpu::initFilterKey() { qCDebug(appLog) << "DeviceGpu::initFilterKey called."; // 添加可显示属性 - 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"); qCDebug(appLog) << "Filter keys initialized."; } @@ -65,11 +65,11 @@ void DeviceGpu::loadBaseDeviceInfo() qCDebug(appLog) << "Loading base device info"; // 添加基本信息 - 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); qCDebug(appLog) << "Base device info loaded."; } @@ -341,7 +341,6 @@ void DeviceGpu::setGpuInfo(const QMap &mapInfo) { qCDebug(appLog) << "Setting GPU info"; - // 华为KLU和PanGuV机器中不需要显示以下信息 m_HDMI = ""; m_VGA = ""; m_DisplayPort = ""; @@ -392,29 +391,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/DeviceGpu.h b/deepin-devicemanager/src/DeviceManager/DeviceGpu.h index d5d4e1f40..46630a23e 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceGpu.h +++ b/deepin-devicemanager/src/DeviceManager/DeviceGpu.h @@ -51,7 +51,7 @@ class DeviceGpu: public DeviceBaseInfo void setDmesgInfo(const QMap &mapInfo); /** - * @brief setGpuInfo:设置从gpuinfo命令中获取的信息,华为KLU笔记本和PanGuV机器专用 + * @brief setGpuInfo:设置从gpuinfo命令中获取的信息 * @param mapInfo:由gpuinfo获取的信息map */ void setGpuInfo(const QMap &mapInfo); diff --git a/deepin-devicemanager/src/DeviceManager/DeviceImage.cpp b/deepin-devicemanager/src/DeviceManager/DeviceImage.cpp index 831f077b2..2ea4bf73c 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceImage.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceImage.cpp @@ -200,11 +200,11 @@ void DeviceImage::loadBaseDeviceInfo() { qCDebug(appLog) << "DeviceImage::loadBaseDeviceInfo called."; // 添加基本信息 - 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); qCDebug(appLog) << "Base device info loaded."; } @@ -212,15 +212,15 @@ void DeviceImage::loadOtherDeviceInfo() { qCDebug(appLog) << "DeviceImage::loadOtherDeviceInfo called."; // 添加其他信息,成员变量 - 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) { qCDebug(appLog) << "SerialID is different from UniqueID, adding Serial Number."; - addOtherDeviceInfo(tr("Serial Number"), m_SerialID); + addOtherDeviceInfo("Serial Number", m_SerialID); } // 将QMap内容转存为QList> diff --git a/deepin-devicemanager/src/DeviceManager/DeviceInfo.cpp b/deepin-devicemanager/src/DeviceManager/DeviceInfo.cpp index 325228ddd..1fd982349 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceInfo.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceInfo.cpp @@ -46,6 +46,16 @@ DeviceBaseInfo::~DeviceBaseInfo() qCDebug(appLog) << "DeviceBaseInfo destructor called."; } +const QString DeviceBaseInfo::translateStr(const QString &inStr) +{ + return tr(inStr.toLatin1()); +} + +const QString DeviceBaseInfo::nameTr() +{ + return translateStr(m_Name); +} + const QList> &DeviceBaseInfo::getOtherAttribs() { qCDebug(appLog) << "DeviceBaseInfo::getOtherAttribs called."; @@ -66,8 +76,37 @@ 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(); qCDebug(appLog) << "DeviceBaseInfo::getTableHeader called."; // 获取表头 if (m_TableHeader.size() == 0) { @@ -75,8 +114,17 @@ const QStringList &DeviceBaseInfo::getTableHeader() loadTableHeader(); m_TableHeader.append(m_CanEnable ? "yes" : "no"); } + + for (const auto &item : m_TableHeader) { + QString trKey = tr(item.toLatin1()); + if (trKey.isEmpty()) + m_TableHeaderTr.append(item); + else + m_TableHeaderTr.append(trKey); + } + qCDebug(appLog) << "Table header: " << m_TableHeader; - return m_TableHeader; + return m_TableHeaderTr; } const QStringList &DeviceBaseInfo::getTableData() @@ -85,8 +133,16 @@ const QStringList &DeviceBaseInfo::getTableData() // 获取表格数据 m_TableData.clear(); loadTableData(); + 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); + } qCDebug(appLog) << "Table data loaded. Count: " << m_TableData.count(); - return m_TableData; + return m_TableDataTr; } QString DeviceBaseInfo::subTitle() @@ -188,8 +244,8 @@ void DeviceBaseInfo::toHtmlString(QDomDocument &doc) { qCDebug(appLog) << "DeviceBaseInfo::toHtmlString called."; // 设备信息转为Html - baseInfoToHTML(doc, m_LstBaseInfo); - baseInfoToHTML(doc, m_LstOtherInfo); + baseInfoToHTML(doc, m_LstBaseInfoTr); + baseInfoToHTML(doc, m_LstOtherInfoTr); qCDebug(appLog) << "HTML string conversion finished."; } @@ -255,8 +311,8 @@ void DeviceBaseInfo::toDocString(Docx::Document &doc) { qCDebug(appLog) << "DeviceBaseInfo::toDocString called."; // 设备信息转为doc - baseInfoToDoc(doc, m_LstBaseInfo); - baseInfoToDoc(doc, m_LstOtherInfo); + baseInfoToDoc(doc, m_LstBaseInfoTr); + baseInfoToDoc(doc, m_LstOtherInfoTr); qCDebug(appLog) << "Doc string conversion finished."; } @@ -285,8 +341,8 @@ void DeviceBaseInfo::toXlsxString(QXlsx::Document &xlsx, QXlsx::Format &boldFont { qCDebug(appLog) << "DeviceBaseInfo::toXlsxString called."; // 设备信息转为xlxs表格 - baseInfoToXlsx(xlsx, boldFont, m_LstBaseInfo); - baseInfoToXlsx(xlsx, boldFont, m_LstOtherInfo); + baseInfoToXlsx(xlsx, boldFont, m_LstBaseInfoTr); + baseInfoToXlsx(xlsx, boldFont, m_LstOtherInfoTr); qCDebug(appLog) << "Xlsx string conversion finished."; } @@ -320,8 +376,8 @@ void DeviceBaseInfo::toTxtString(QTextStream &out) { qCDebug(appLog) << "DeviceBaseInfo::toTxtString called."; // 设备信息转为txt - baseInfoToTxt(out, m_LstBaseInfo); - baseInfoToTxt(out, m_LstOtherInfo); + baseInfoToTxt(out, m_LstBaseInfoTr); + baseInfoToTxt(out, m_LstOtherInfoTr); qCDebug(appLog) << "Txt string conversion finished."; } @@ -356,18 +412,18 @@ void DeviceBaseInfo::tableInfoToTxt(QTextStream &out) getTableData(); // 判断是否有表格内容 - if (m_TableData.size() < 1) { + if (m_TableDataTr.size() < 1) { qCDebug(appLog) << "Table data is empty, skipping Txt conversion."; return; } // 设置占位宽度 - QString text = m_TableData[0]; + QString text = m_TableDataTr[0]; out.setFieldWidth(int(text.size() * 1.5)); out.setFieldAlignment(QTextStream::FieldAlignment::AlignRight); qCDebug(appLog) << "Txt field width set for table info."; - foreach (auto item, m_TableData) { + foreach (auto item, m_TableDataTr) { out.setFieldWidth(28); out << item; // qCDebug(appLog) << "Written table item to Txt: " << item; @@ -385,22 +441,22 @@ void DeviceBaseInfo::tableHeaderToTxt(QTextStream &out) getTableHeader(); // 判断是否有表头 - if (m_TableHeader.size() < 1) { + if (m_TableHeaderTr.size() < 1) { qCDebug(appLog) << "Table header is empty, skipping Txt conversion."; return; } // 设置占位宽度 - QString text = m_TableHeader[0]; + QString text = m_TableHeaderTr[0]; out.setFieldWidth(int(text.size() * 1.5)); out.setFieldAlignment(QTextStream::FieldAlignment::AlignLeft); qCDebug(appLog) << "Txt field width set for table header."; 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]; - // qCDebug(appLog) << "Written table header item to Txt: " << m_TableHeader[col]; + out << m_TableHeaderTr[col]; + // qCDebug(appLog) << "Written table header item to Txt: " << m_TableHeaderTr[col]; } out.setFieldWidth(0); out << "\n"; @@ -436,7 +492,7 @@ void DeviceBaseInfo::tableHeaderToHtml(QFile &html) getTableHeader(); // 判断是否有表头 - if (m_TableHeader.size() < 1) { + if (m_TableHeaderTr.size() < 1) { qCDebug(appLog) << "Table header is empty, skipping HTML table header conversion."; return; } @@ -445,9 +501,9 @@ void DeviceBaseInfo::tableHeaderToHtml(QFile &html) qCDebug(appLog) << "Written HTML table header start tags."; // 写表头内容 - for (int col = 0; col < m_TableHeader.size() - 1; ++col) { - html.write(QString("" + m_TableHeader[col] + "").toUtf8().data()); - // qCDebug(appLog) << "Written table header item to HTML: " << m_TableHeader[col]; + for (int col = 0; col < m_TableHeaderTr.size() - 1; ++col) { + html.write(QString("" + m_TableHeaderTr[col] + "").toUtf8().data()); + // qCDebug(appLog) << "Written table header item to HTML: " << m_TableHeaderTr[col]; } html.write("\n"); @@ -466,16 +522,16 @@ void DeviceBaseInfo::tableInfoToDoc(Docx::Table *tab, int &row) // 获取表格数据 getTableData(); - if (m_TableData.size() < 1) { + if (m_TableDataTr.size() < 1) { qCDebug(appLog) << "Table data is empty, skipping Doc table info conversion."; 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]); - // qCDebug(appLog) << "Added table info to Doc cell (" << row << ", " << col << "): " << m_TableData[col]; + cel->addText(m_TableDataTr[col]); + // qCDebug(appLog) << "Added table info to Doc cell (" << row << ", " << col << "): " << m_TableDataTr[col]; } qCDebug(appLog) << "Finished adding table info to Doc."; } @@ -486,17 +542,17 @@ void DeviceBaseInfo::tableHeaderToDoc(Docx::Table *tab) // 表头保存为doc getTableHeader(); - if (m_TableHeader.size() < 1) { + if (m_TableHeaderTr.size() < 1) { qCDebug(appLog) << "Table header is empty, skipping Doc table header conversion."; 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]); - // qCDebug(appLog) << "Added table header to Doc cell (0, " << col << "): " << m_TableHeader[col]; + cel->addText(m_TableHeaderTr[col]); + // qCDebug(appLog) << "Added table header to Doc cell (0, " << col << "): " << m_TableHeaderTr[col]; } qCDebug(appLog) << "Finished adding table header to Doc."; } @@ -507,16 +563,16 @@ void DeviceBaseInfo::tableInfoToXlsx(QXlsx::Document &xlsx) // 获取表格信息 getTableData(); - if (m_TableData.size() < 1) { + if (m_TableDataTr.size() < 1) { qCDebug(appLog) << "Table data is empty, skipping Xlsx table info conversion."; return; } // 添加表格信息 int curRow = DeviceManager::instance()->currentXlsRow(); - for (int col = 0; col < m_TableData.size(); ++col) { - xlsx.write(curRow, col + 1, m_TableData[col]); - // qCDebug(appLog) << "Written table info to Xlsx at row " << curRow << ", col " << col + 1 << ": " << m_TableData[col]; + for (int col = 0; col < m_TableDataTr.size(); ++col) { + xlsx.write(curRow, col + 1, m_TableDataTr[col]); + // qCDebug(appLog) << "Written table info to Xlsx at row " << curRow << ", col " << col + 1 << ": " << m_TableDataTr[col]; } qCDebug(appLog) << "Finished writing table info to Xlsx."; } @@ -527,19 +583,19 @@ void DeviceBaseInfo::tableHeaderToXlsx(QXlsx::Document &xlsx) // 获取表头 getTableHeader(); - if (m_TableHeader.size() < 1) { + if (m_TableHeaderTr.size() < 1) { qCDebug(appLog) << "Table header is empty, skipping Xlsx table header conversion."; 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); - // qCDebug(appLog) << "Written table header to Xlsx at row " << curRow << ", col " << col + 1 << ": " << m_TableHeader[col]; + xlsx.write(curRow, col + 1, m_TableHeaderTr[col], boldFont); + // qCDebug(appLog) << "Written table header to Xlsx at row " << curRow << ", col " << col + 1 << ": " << m_TableHeaderTr[col]; } qCDebug(appLog) << "Finished writing table header to Xlsx."; } @@ -787,9 +843,9 @@ void DeviceBaseInfo::loadTableHeader() { qCDebug(appLog) << "DeviceBaseInfo::loadTableHeader called. Adding default table headers."; // 添加表头信息 - 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) @@ -805,7 +861,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()) { @@ -840,6 +896,45 @@ void DeviceBaseInfo::addOtherDeviceInfo(const QString &key, const QString &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) { qCDebug(appLog) << "DeviceBaseInfo::setAttribute called with key: " << key << ", overwrite: " << overwrite; 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) qCDebug(appLog) << "Exiting setInfoFromHwinfo."; } -void DeviceInput::setKLUInfoFromHwinfo(const QMap &mapInfo) -{ - qCDebug(appLog) << "setKLUInfoFromHwinfo"; - - // 设置设备基本属性 - 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()) { - qCDebug(appLog) << "Found 'Hotplug' in mapInfo, setting interface."; - setAttribute(mapInfo, "Hotplug", m_Interface); - } else { - qCDebug(appLog) << "'Hotplug' not found, setting interface to PS/2."; - m_Interface = "PS/2"; - } - - // 上面的方法不适合蓝牙键盘的获取方法 - if (mapInfo.find("Model")->contains("Bluetooth", Qt::CaseInsensitive) || mapInfo.find("Device")->contains("Bluetooth", Qt::CaseInsensitive)) { - qCDebug(appLog) << "Model or Device contains Bluetooth, setting interface to Bluetooth."; - 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) { - qCDebug(appLog) << "SysFS BusID split into 2 words."; - QStringList chs = words[0].split("-"); - if (chs.size() == 2) { - qCDebug(appLog) << "First word split into 2 parts, setting m_KeyToLshw."; - m_KeyToLshw = QString("usb@%1:%2").arg(chs[0]).arg(chs[1]); - } - } - - // 由bluetoothctl paired-devices设置设备接口 - setInfoFromBluetoothctl(); - qCDebug(appLog) << "Info set from Bluetoothctl."; - - // 获取其他设备信息 - getOtherMapInfo(mapInfo); - qCDebug(appLog) << "Exiting setKLUInfoFromHwinfo."; -} - void DeviceInput::setInfoFromBluetoothctl() { qCDebug(appLog) << "Entering setInfoFromBluetoothctl."; @@ -605,16 +556,15 @@ bool DeviceInput::bluetoothIsConnected() void DeviceInput::initFilterKey() { // 添加可显示的设备信息 - qCDebug(appLog) << "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(QObject::tr("physical id")); + addFilterKey("Uniq"); + addFilterKey("PROP"); + addFilterKey("EV"); + addFilterKey("KEY"); + addFilterKey("MSC"); + addFilterKey("Device File"); + addFilterKey("Hardware Class"); + + // addFilterKey("physical id"); qCDebug(appLog) << "initFilterKey end"; } @@ -622,11 +572,11 @@ void DeviceInput::loadBaseDeviceInfo() { qCDebug(appLog) << "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); qCDebug(appLog) << "loadBaseDeviceInfo end"; } @@ -634,13 +584,13 @@ void DeviceInput::loadOtherDeviceInfo() { qCDebug(appLog) << "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 aeadf8987..6ac7b1028 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceManager.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceManager.cpp @@ -424,7 +424,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) { qCDebug(appLog) << "Setting TOML device for deviceType:" << deviceType; if (!device) { @@ -512,6 +512,93 @@ 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) { qCDebug(appLog) << "Setting TOML device for deviceType:" << deviceType; @@ -538,7 +625,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); } @@ -547,7 +634,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;... @@ -888,24 +975,6 @@ bool DeviceManager::setStorageDeviceMediaType(const QString &name, const QString return false; } -bool DeviceManager::setKLUStorageDeviceMediaType(const QString &name, const QString &value) -{ - qCDebug(appLog) << "Setting KLU storage device media type"; - // 设置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) { // qCDebug(appLog) << "Adding GPU 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 7ef9946fa..af77358d7 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceMemory.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceMemory.cpp @@ -127,26 +127,26 @@ void DeviceMemory::initFilterKey() { qCDebug(appLog) << "Initializing filter keys for memory device"; // 初始化可显示属性 - 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 qCDebug(appLog) << "Filter keys initialized"; } @@ -154,14 +154,14 @@ void DeviceMemory::loadBaseDeviceInfo() { qCDebug(appLog) << "Loading base device info for memory"; // 添加基本信息 - 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); qCDebug(appLog) << "Base device info loaded"; } @@ -172,15 +172,15 @@ void DeviceMemory::loadOtherDeviceInfo() // 添加其他信息,成员变量 if (Common::boardVendorType().isEmpty()) { qCDebug(appLog) << "Board vendor type is empty, loading full voltage info"; - 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 { qCDebug(appLog) << "Board vendor type is not empty, loading configured speed only"; - 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(); @@ -191,11 +191,11 @@ void DeviceMemory::loadTableHeader() { qCDebug(appLog) << "Loading table header for memory"; // 加载表头 - 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"); qCDebug(appLog) << "Table header loaded"; } diff --git a/deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp b/deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp index 8f9f2d9fd..b04842293 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp @@ -193,6 +193,7 @@ TomlFixMethod DeviceMonitor::setInfoFromTomlOneByOne(const QMap &mapInfo) -{ - qCDebug(appLog) << "Setting monitor info from self-defined map"; - 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); - qCDebug(appLog) << "Finished setting monitor info from self-defined map"; -} - void DeviceMonitor::setInfoFromEdid(const QMap &mapInfo) { qCDebug(appLog) << "Setting monitor info from EDID data"; @@ -358,33 +345,33 @@ const QString DeviceMonitor::getOverviewInfo() void DeviceMonitor::initFilterKey() { qCDebug(appLog) << "Initializing filter keys for monitor"; - addFilterKey(QObject::tr("Date")); + addFilterKey("Date"); } void DeviceMonitor::loadBaseDeviceInfo() { qCDebug(appLog) << "Loading base device info for monitor"; // 添加基本信息 - 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() { qCDebug(appLog) << "Loading other device info for monitor"; // 添加其他信息,成员变量 - addOtherDeviceInfo(tr("Support Resolution"), m_SupportResolution); + 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(); qCDebug(appLog) << "Other device info loaded"; @@ -553,6 +540,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..d53832bc1 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceMonitor.h +++ b/deepin-devicemanager/src/DeviceManager/DeviceMonitor.h @@ -59,23 +59,17 @@ 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里面获取的*/ + /**@brief:PanGuV项目里面的显示屏信息是从edid里面获取的*/ /** - * @brief setInfoFromEdid:设置华为PanGuV项目里面的显示屏信息(从edid里面获取的) + * @brief setInfoFromEdid:设置PanGuV项目里面的显示屏信息(从edid里面获取的) * @param mapInfo:edid中获取的信息map */ void setInfoFromEdid(const QMap &mapInfo); - /**@brief:华为PanGuV项目里面的显示屏信息是从dbus里面获取的*/ + /**@brief:PanGuV项目里面的显示屏信息是从dbus里面获取的*/ /** - * @brief setInfoFromDbus:设置华为PanGuV项目里面的显示屏信息 + * @brief setInfoFromDbus:设置PanGuV项目里面的显示屏信息 * @param mapInfo:获取的信息map */ void setInfoFromDbus(const QMap &mapInfo); @@ -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)) { qCDebug(appLog) << "DeviceNetwork::setInfoFromLshw, driver is kernel in"; @@ -208,7 +208,7 @@ bool DeviceNetwork::setInfoFromWifiInfo(const QMap &mapInfo) { qCDebug(appLog) << "DeviceNetwork::setInfoFromWifiInfo"; // 机器自身蓝牙 - if (m_Name.contains("Huawei", Qt::CaseInsensitive)) { + if (m_Name.contains(Common::specialHString(), Qt::CaseInsensitive)) { qCDebug(appLog) << "DeviceNetwork::setInfoFromWifiInfo, name contains Huawei"; setAttribute(mapInfo, "Chip Type", m_Name); setAttribute(mapInfo, "Vendor", m_Vendor); @@ -326,47 +326,47 @@ void DeviceNetwork::initFilterKey() { qCDebug(appLog) << "DeviceNetwork::initFilterKey"; // 初始化可显示属性 - addFilterKey(QObject::tr("ioport")); - addFilterKey(QObject::tr("network")); + addFilterKey("ioport"); + addFilterKey("network"); } void DeviceNetwork::loadBaseDeviceInfo() { qCDebug(appLog) << "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() { qCDebug(appLog) << "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(); @@ -375,9 +375,9 @@ void DeviceNetwork::loadOtherDeviceInfo() void DeviceNetwork::loadTableHeader() { qCDebug(appLog) << "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 12b89052c..114d4c50e 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceOtherPCI.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceOtherPCI.cpp @@ -81,25 +81,25 @@ void DeviceOtherPCI::loadBaseDeviceInfo() { qCDebug(appLog) << "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() { qCDebug(appLog) << "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 8fcf6e2ec..5173aa210 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceOthers.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceOthers.cpp @@ -207,30 +207,30 @@ bool DeviceOthers::available() void DeviceOthers::initFilterKey() { // qCDebug(appLog) << "DeviceOthers::initFilterKey"; - addFilterKey(QObject::tr("Device File")); - addFilterKey(QObject::tr("Hardware Class")); + addFilterKey("Device File"); + addFilterKey("Hardware Class"); } void DeviceOthers::loadBaseDeviceInfo() { qCDebug(appLog) << "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() { qCDebug(appLog) << "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 5e67e14b2..0453de88a 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" #include "DDLog.h" // Qt库文件 @@ -88,8 +89,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); @@ -160,52 +159,56 @@ void DevicePower::initFilterKey() { qCDebug(appLog) << "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() { qCDebug(appLog) << "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 3d987229b..b3e4ad1df 100644 --- a/deepin-devicemanager/src/DeviceManager/DevicePrint.cpp +++ b/deepin-devicemanager/src/DeviceManager/DevicePrint.cpp @@ -145,43 +145,43 @@ void DevicePrint::initFilterKey() { qCDebug(appLog) << "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() { qCDebug(appLog) << "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() { qCDebug(appLog) << "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 12c660d72..0dde95ca1 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceStorage.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceStorage.cpp @@ -148,8 +148,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"; } } } @@ -338,68 +340,6 @@ QString DeviceStorage::getSerialID(QString &strDeviceLink) return strSerialNumber; } -bool DeviceStorage::setKLUHwinfoInfo(const QMap &mapInfo) -{ - qCDebug(appLog) << "DeviceStorage::setKLUHwinfoInfo"; - // 龙芯机器中 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); - QRegularExpression re(".*\\((.*)\\).*"); - QRegularExpressionMatch match = re.match(m_Interface); - if (match.hasMatch()) { - qCDebug(appLog) << "DeviceStorage::setKLUHwinfoInfo, interface has match"; - m_Interface = match.captured(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) 需要处理 - QRegularExpression reSize(".*\\((.*)bytes\\).*"); - match = reSize.match(m_Size); - if (match.hasMatch()) { - qCDebug(appLog) << "DeviceStorage::setKLUHwinfoInfo, size has match"; - bool ok = false; - quint64 bytesSize = match.captured(1).trimmed().toULongLong(&ok); - if (ok) { - qCDebug(appLog) << "DeviceStorage::setKLUHwinfoInfo, size convert to ullong success"; - m_Size = decimalkilos(bytesSize); - } else { - qCDebug(appLog) << "DeviceStorage::setKLUHwinfoInfo, size convert to ullong failed"; - m_Size.replace(QRegularExpression("\\(.*\\)"), "").replace(" ", ""); - } - } else { - qCDebug(appLog) << "DeviceStorage::setKLUHwinfoInfo, size has no match"; - m_Size.replace(QRegularExpression("\\(.*\\)"), "").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")) { - qCDebug(appLog) << "DeviceStorage::setKLUHwinfoInfo, driver contains usb-storage"; - m_MediaType = "USB"; - } - - getOtherMapInfo(mapInfo); - return true; -} - bool DeviceStorage::addInfoFromlshw(const QMap &mapInfo) { qCDebug(appLog) << "Add lshw info for storage device"; @@ -495,33 +435,6 @@ bool DeviceStorage::setMediaType(const QString &name, const QString &value) return true; } -bool DeviceStorage::setKLUMediaType(const QString &name, const QString &value) -{ - qCDebug(appLog) << "DeviceStorage::setKLUMediaType"; - if (!m_DeviceFile.contains(name)) { - qCDebug(appLog) << "DeviceStorage::setKLUMediaType, device file does not contain name"; - return false; - } - - if (m_MediaType == "USB") { - qCDebug(appLog) << "DeviceStorage::setKLUMediaType, media type is USB"; - return true; - } - - if (QString("0") == value) { - qCDebug(appLog) << "DeviceStorage::setKLUMediaType, media type is SSD"; - m_MediaType = QObject::tr("SSD"); - } else if (QString("1") == value) { - qCDebug(appLog) << "DeviceStorage::setKLUMediaType, media type is HDD"; - m_MediaType = QObject::tr("HDD"); - } else { - qCDebug(appLog) << "DeviceStorage::setKLUMediaType, media type is Unknown"; - m_MediaType = QObject::tr("Unknown"); - } - - return true; -} - bool DeviceStorage::isValid() { qCDebug(appLog) << "DeviceStorage::isValid"; @@ -716,18 +629,18 @@ void DeviceStorage::initFilterKey() { qCDebug(appLog) << "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)"); } @@ -735,21 +648,21 @@ void DeviceStorage::loadBaseDeviceInfo() { qCDebug(appLog) << "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() { qCDebug(appLog) << "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); @@ -761,11 +674,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")) { qCDebug(appLog) << "DeviceStorage::loadOtherDeviceInfo, rotation rate is Solid State Device"; @@ -780,10 +693,10 @@ void DeviceStorage::loadTableHeader() { qCDebug(appLog) << "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() @@ -793,7 +706,7 @@ void DeviceStorage::loadTableData() QString model = m_Name; if (!available()) { qCDebug(appLog) << "DeviceStorage::loadTableData, not 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 7c4c178f2..220e5a5c0 100644 --- a/deepin-devicemanager/src/GenerateDevice/CmdTool.cpp +++ b/deepin-devicemanager/src/GenerateDevice/CmdTool.cpp @@ -682,14 +682,7 @@ void CmdTool::getMulHwinfoInfo(const QString &info) addMapInfo("hwinfo_sound", mapInfo); } else if (mapInfo["Hardware Class"].contains("network")) { qCDebug(appLog) << "Found network device."; - //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); - } else { - qCDebug(appLog) << "Skipping network device without path or address."; - } + addMapInfo("hwinfo_network", mapInfo); } else if ("keyboard" == mapInfo["Hardware Class"]) { qCDebug(appLog) << "Found keyboard device."; addMouseKeyboardInfoMapInfo("hwinfo_keyboard", mapInfo); diff --git a/deepin-devicemanager/src/GenerateDevice/DeviceFactory.cpp b/deepin-devicemanager/src/GenerateDevice/DeviceFactory.cpp index 4cd10ff69..dbeb3f1fe 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" #include "DDLog.h" @@ -47,13 +45,13 @@ DeviceGenerator *DeviceFactory::getDeviceGenerator() if (!type.isEmpty()) { if (type == "KLVV") { qCDebug(appLog) << "DeviceFactory::getDeviceGenerator create KLVGenerator"; - generator = new KLVGenerator(); + generator = new HWGenerator(); } else if (type == "PGUV" || type == "PGUW") { qCDebug(appLog) << "DeviceFactory::getDeviceGenerator create PanguVGenerator"; generator = new PanguVGenerator(); } else if (type == "KLVU") { qCDebug(appLog) << "DeviceFactory::getDeviceGenerator create KLUGenerator"; - generator = new KLUGenerator(); + generator = new HWGenerator(); } else if (type == "PGUX") { qCDebug(appLog) << "DeviceFactory::getDeviceGenerator create PanguXGenerator"; generator = new PanguXGenerator(); diff --git a/deepin-devicemanager/src/GenerateDevice/DeviceGenerator.cpp b/deepin-devicemanager/src/GenerateDevice/DeviceGenerator.cpp index 9f00405c2..bd7958a52 100644 --- a/deepin-devicemanager/src/GenerateDevice/DeviceGenerator.cpp +++ b/deepin-devicemanager/src/GenerateDevice/DeviceGenerator.cpp @@ -33,6 +33,7 @@ // Qt库文件 #include #include +#include using namespace DDLog; @@ -48,8 +49,6 @@ DeviceGenerator::~DeviceGenerator() } - - void DeviceGenerator::generatorComputerDevice() { qCDebug(appLog) << "DeviceGenerator::generatorComputerDevice start"; @@ -298,49 +297,74 @@ 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); } } } diff --git a/deepin-devicemanager/src/GenerateDevice/HWGenerator.cpp b/deepin-devicemanager/src/GenerateDevice/HWGenerator.cpp index 2dd0f5dd1..2d3534f30 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 "commondefine.h" #include "DDLog.h" // Qt库文件 @@ -28,10 +30,12 @@ #include "DeviceManager/DeviceNetwork.h" #include "DeviceManager/DeviceMemory.h" +static QString boardVendorType; using namespace DDLog; HWGenerator::HWGenerator() { + boardVendorType = Common::boardVendorType(); qCDebug(appLog) << "HWGenerator constructor"; } @@ -101,6 +105,16 @@ void HWGenerator::generatorCpuDevice() qCDebug(appLog) << "HWGenerator::generatorCpuDevice start"; 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); + } + } qCDebug(appLog) << "HWGenerator::generatorCpuDevice end"; } @@ -118,6 +132,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); + } + } qCDebug(appLog) << "HWGenerator::generatorBluetoothDevice end"; } @@ -174,72 +198,13 @@ void HWGenerator::generatorGpuDevice() void HWGenerator::generatorNetworkDevice() { qCDebug(appLog) << "HWGenerator::generatorNetworkDevice start"; - QList lstDevice; - const QList> &lstHWInfo = DeviceManager::instance()->cmdInfo("hwinfo_network"); - for (QList >::const_iterator it = lstHWInfo.begin(); it != lstHWInfo.end(); ++it) { - // qCDebug(appLog) << "HWGenerator::generatorNetworkDevice process hwinfo"; - // 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())) { - // qCDebug(appLog) << "HWGenerator::generatorNetworkDevice invalid network device"; - continue; - } - // 如果(*it)中包含unique_id属性,则说明是从数据库里面获取的,否则是从hwinfo中获取的 - if ((*it).find("unique_id") == (*it).end()) { - // qCDebug(appLog) << "HWGenerator::generatorNetworkDevice create network device from hwinfo"; - DeviceNetwork *device = new DeviceNetwork(); - device->setInfoFromHwinfo(*it); - if (!device->available()) { - // qCDebug(appLog) << "HWGenerator::generatorNetworkDevice device not available"; - device->setCanEnale(false); - device->setCanUninstall(false); - device->setForcedDisplay(true); - } - lstDevice.append(device); - } else { - // qCDebug(appLog) << "HWGenerator::generatorNetworkDevice create network device from db"; - 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) { - // qCDebug(appLog) << "HWGenerator::generatorNetworkDevice set device enable value to false"; - 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) { - // qCDebug(appLog) << "HWGenerator::generatorNetworkDevice process lshw"; - if ((*it).find("serial") == (*it).end()) { - // qCDebug(appLog) << "HWGenerator::generatorNetworkDevice no serial in lshw info"; - continue; - } - const QString &serialNumber = (*it)["serial"]; - for (QList::iterator itDevice = lstDevice.begin(); itDevice != lstDevice.end(); ++itDevice) { - if (!serialNumber.isEmpty() && (*itDevice)->uniqueID() == serialNumber) { - qCDebug(appLog) << "HWGenerator::generatorNetworkDevice set lshw info to device"; - (*itDevice)->setInfoFromLshw(*it); - break; - } - } + if (boardVendorType == "KLVV") { + getNetworkInfoFromCatWifiInfo(); } - foreach (DeviceNetwork *device, lstDevice) { - // qCDebug(appLog) << "HWGenerator::generatorNetworkDevice add network device"; - DeviceManager::instance()->addNetworkDevice(device); - } qCDebug(appLog) << "HWGenerator::generatorNetworkDevice end"; } @@ -248,6 +213,59 @@ void HWGenerator::generatorDiskDevice() qCDebug(appLog) << "HWGenerator::generatorDiskDevice start"; 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); + } + } qCDebug(appLog) << "HWGenerator::generatorDiskDevice end"; } @@ -265,13 +283,13 @@ void HWGenerator::getAudioInfoFromCatAudio() QMap tempMap = *it; if (tempMap["Name"].contains("da_combine_v5", Qt::CaseInsensitive)) { // qCDebug(appLog) << "HWGenerator::getAudioInfoFromCatAudio fix audio name"; - tempMap["Name"] = "Hi6405"; - tempMap["Model"] = "Hi6405"; + tempMap["Name"] = "OnBoard Audio"; + tempMap["Model"] = "OnBoard Audio"; } if (tempMap.contains("Vendor")) { // qCDebug(appLog) << "HWGenerator::getAudioInfoFromCatAudio fix audio vendor"; - tempMap["Vendor"]= "HUAWEI"; + tempMap["Vendor"]= Common::specialHString();; } DeviceAudio *device = new DeviceAudio(); @@ -285,42 +303,6 @@ void HWGenerator::getAudioInfoFromCatAudio() qCDebug(appLog) << "HWGenerator::getAudioInfoFromCatAudio end"; } -void HWGenerator::getDiskInfoFromLshw() -{ - qCDebug(appLog) << "HWGenerator::getDiskInfoFromLshw start"; - 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() { qCDebug(appLog) << "HWGenerator::getDiskInfoFromSmartCtl start"; @@ -441,12 +423,12 @@ 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(); } - // 按照华为的需求,设置蓝牙制造商和类型 + // 按照的需求,设置蓝牙制造商和类型 tempMap["Vendor"] = "HISILICON"; tempMap["Type"] = "Bluetooth Device"; @@ -531,6 +513,22 @@ static void parseEDID(QStringList allEDIDS,QString input) void HWGenerator::generatorMonitorDevice() { qCDebug(appLog) << "HWGenerator::generatorMonitorDevice start"; + + 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); @@ -553,3 +551,139 @@ 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(':', QT_SKIP_EMPTY_PARTS); + 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 a7409f69e..000000000 --- a/deepin-devicemanager/src/GenerateDevice/KLUGenerator.cpp +++ /dev/null @@ -1,218 +0,0 @@ -// SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -// 项目自身文件 -#include "KLUGenerator.h" -#include "DDLog.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" - -using namespace DDLog; - -KLUGenerator::KLUGenerator() -{ - qCDebug(appLog) << "KLUGenerator constructor"; - -} - -void KLUGenerator::getDiskInfoFromLshw() -{ - qCDebug(appLog) << "KLUGenerator::getDiskInfoFromLshw start"; - QString bootdevicePath("/proc/bootdevice/product_name"); - QString modelStr = ""; - QFile file(bootdevicePath); - if (file.open(QIODevice::ReadOnly)) { - qCDebug(appLog) << "KLUGenerator::getDiskInfoFromLshw open bootdevice file success"; - 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) { - // qCDebug(appLog) << "KLUGenerator::getDiskInfoFromLshw process lshw disk info"; - if ((*dIt).size() < 2) { - // qCDebug(appLog) << "KLUGenerator::getDiskInfoFromLshw disk info not enough"; - 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) { - // qCDebug(appLog) << "KLUGenerator::getDiskInfoFromLshw find boot device"; - // 应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) { - // qCDebug(appLog) << "KLUGenerator::getDiskInfoFromLshw get wb_en success"; - QString deviceInfo = process.readAllStandardOutput(); - if (deviceInfo.trimmed() == "true") { - // qCDebug(appLog) << "KLUGenerator::getDiskInfoFromLshw wb_en is true"; - process.start("cat /sys/block/sdd/device/spec_version"); - process.waitForFinished(-1); - exitCode = process.exitCode(); - if (exitCode != 127 && exitCode != 126) { - // qCDebug(appLog) << "KLUGenerator::getDiskInfoFromLshw get spec_version success"; - deviceInfo = process.readAllStandardOutput(); - if (deviceInfo.trimmed() == "310") { - // qCDebug(appLog) << "KLUGenerator::getDiskInfoFromLshw spec_version is 310, set interface to UFS 3.1"; - tempMap["interface"] = "UFS 3.1"; - } - } - } - } - } - - DeviceManager::instance()->addLshwinfoIntoStorageDevice(tempMap); - } - qCDebug(appLog) << "KLUGenerator::getDiskInfoFromLshw end"; -} - -void KLUGenerator::generatorNetworkDevice() -{ - qCDebug(appLog) << "KLUGenerator::generatorNetworkDevice start"; - const QList> lstInfo = DeviceManager::instance()->cmdInfo("lshw_network"); - QList >::const_iterator it = lstInfo.begin(); - for (; it != lstInfo.end(); ++it) { - // qCDebug(appLog) << "KLUGenerator::generatorNetworkDevice process lshw network info"; - if ((*it).size() < 2) { - // qCDebug(appLog) << "KLUGenerator::generatorNetworkDevice network info not enough"; - 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)) { - // qCDebug(appLog) << "KLUGenerator::generatorNetworkDevice is wireless interface, skip"; - continue; - } - - DeviceNetwork *device = new DeviceNetwork(); - device->setInfoFromLshw(*it); - device->setCanEnale(false); - device->setCanUninstall(false); - device->setForcedDisplay(true); - DeviceManager::instance()->addNetworkDevice(device); - } - // HW 要求修改名称,制造商以及类型 - getNetworkInfoFromCatWifiInfo(); - qCDebug(appLog) << "KLUGenerator::generatorNetworkDevice end"; -} - -void KLUGenerator::getNetworkInfoFromCatWifiInfo() -{ - qCDebug(appLog) << "KLUGenerator::getNetworkInfoFromCatWifiInfo start"; - QList > lstWifiInfo; - QString wifiDevicesInfoPath("/sys/hisys/wal/wifi_devices_info"); - QFile file(wifiDevicesInfoPath); - if (file.open(QIODevice::ReadOnly)) { - qCDebug(appLog) << "KLUGenerator::getNetworkInfoFromCatWifiInfo open wifi info file success"; - QMap wifiInfo; - QString allStr = file.readAll(); - file.close(); - - // 解析数据 - QStringList items = allStr.split("\n"); - foreach (const QString &item, items) { - if (item.isEmpty()) - continue; -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) - QStringList strList = item.split(':', QString::SkipEmptyParts); -#else - QStringList strList = item.split(':', Qt::SkipEmptyParts); -#endif - if (strList.size() == 2) { - // qCDebug(appLog) << "KLUGenerator::getNetworkInfoFromCatWifiInfo get wifi info:" << strList[0] << strList[1]; - wifiInfo[strList[0] ] = strList[1]; - } - } - - if (!wifiInfo.isEmpty()) { - // qCDebug(appLog) << "KLUGenerator::getNetworkInfoFromCatWifiInfo wifi info not empty, add to list"; - lstWifiInfo.append(wifiInfo); - } - } else { - qCWarning(appLog) << "KLUGenerator::getNetworkInfoFromCatWifiInfo open wifi info file failed"; - } - if (lstWifiInfo.size() == 0) { - qCWarning(appLog) << "KLUGenerator::getNetworkInfoFromCatWifiInfo no wifi info"; - return; - } - QList >::const_iterator it = lstWifiInfo.begin(); - - for (; it != lstWifiInfo.end(); ++it) { - // qCDebug(appLog) << "KLUGenerator::getNetworkInfoFromCatWifiInfo process wifi info"; - if ((*it).size() < 3) { - // qCDebug(appLog) << "KLUGenerator::getNetworkInfoFromCatWifiInfo wifi info not enough"; - 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)) { - // qCDebug(appLog) << "KLUGenerator::getNetworkInfoFromCatWifiInfo fix chip type"; - tempMap["Chip Type"] = tempMap["Chip Type"].remove("HUAWEI").trimmed(); - } - - // 按照华为的需求,设置蓝牙制造商和类型 - tempMap["Vendor"] = "HISILICON"; - tempMap["Type"] = "Wireless network"; - - DeviceManager::instance()->setNetworkInfoFromWifiInfo(tempMap); - } - qCDebug(appLog) << "KLUGenerator::getNetworkInfoFromCatWifiInfo end"; -} - -void KLUGenerator::generatorMonitorDevice() -{ - qCDebug(appLog) << "KLUGenerator::generatorMonitorDevice start"; - 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); - qCDebug(appLog) << "KLUGenerator::generatorMonitorDevice end"; -} - 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 ca81626aa..000000000 --- a/deepin-devicemanager/src/GenerateDevice/KLVGenerator.cpp +++ /dev/null @@ -1,285 +0,0 @@ -// SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -// 项目自身文件 -#include "KLVGenerator.h" -#include "DDLog.h" - -// Qt库文件 -#include -#include - -// 其它头文件 -#include "DeviceManager/DeviceManager.h" -#include "DeviceManager/DeviceMonitor.h" -#include "DeviceManager/DeviceNetwork.h" -#include "DeviceManager/DeviceImage.h" - -using namespace DDLog; - -KLVGenerator::KLVGenerator() -{ - qCDebug(appLog) << "KLVGenerator constructor"; - -} - -void KLVGenerator::generatorMonitorDevice() -{ - qCDebug(appLog) << "KLVGenerator::generatorMonitorDevice start"; - 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(); - qCDebug(appLog) << "KLVGenerator::generatorMonitorDevice end"; -} - -void KLVGenerator::generatorNetworkDevice() -{ - qCDebug(appLog) << "KLVGenerator::generatorNetworkDevice start"; - const QList> lstInfo = DeviceManager::instance()->cmdInfo("lshw_network"); - QList >::const_iterator it = lstInfo.begin(); - for (; it != lstInfo.end(); ++it) { - // qCDebug(appLog) << "KLVGenerator::generatorNetworkDevice process lshw network info"; - if ((*it).size() < 2) { - // qCDebug(appLog) << "KLVGenerator::generatorNetworkDevice network info not enough"; - 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)) { - // qCDebug(appLog) << "KLVGenerator::generatorNetworkDevice is wireless interface, skip"; - continue; - } - - DeviceNetwork *device = new DeviceNetwork(); - device->setInfoFromLshw(*it); - device->setCanEnale(false); - device->setCanUninstall(false); - device->setForcedDisplay(true); - DeviceManager::instance()->addNetworkDevice(device); - } - // HW 要求修改名称,制造商以及类型 - getNetworkInfoFromCatWifiInfo(); - qCDebug(appLog) << "KLVGenerator::generatorNetworkDevice end"; -} - -void KLVGenerator::getNetworkInfoFromCatWifiInfo() -{ - qCDebug(appLog) << "KLVGenerator::getNetworkInfoFromCatWifiInfo start"; - QList > lstWifiInfo; - QString wifiDevicesInfoPath("/sys/hisys/wal/wifi_devices_info"); - QFile file(wifiDevicesInfoPath); - if (file.open(QIODevice::ReadOnly)) { - qCDebug(appLog) << "KLVGenerator::getNetworkInfoFromCatWifiInfo open wifi info file success"; - QMap wifiInfo; - QString allStr = file.readAll(); - file.close(); - - // 解析数据 - QStringList items = allStr.split("\n"); - foreach (const QString &item, items) { - // qCDebug(appLog) << "KLVGenerator::getNetworkInfoFromCatWifiInfo process item:" << item; - if (item.isEmpty()) { - // qCDebug(appLog) << "KLVGenerator::getNetworkInfoFromCatWifiInfo item is empty, skip"; - continue; - } -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) - QStringList strList = item.split(':', QString::SkipEmptyParts); -#else - QStringList strList = item.split(':'); -#endif - if (strList.size() == 2) { - // qCDebug(appLog) << "KLVGenerator::getNetworkInfoFromCatWifiInfo get wifi info:" << strList[0] << strList[1]; - wifiInfo[strList[0] ] = strList[1]; - } - } - - if (!wifiInfo.isEmpty()) { - // qCDebug(appLog) << "KLVGenerator::getNetworkInfoFromCatWifiInfo wifi info not empty, add to list"; - lstWifiInfo.append(wifiInfo); - } - } else { - qCWarning(appLog) << "KLVGenerator::getNetworkInfoFromCatWifiInfo open wifi info file failed"; - } - if (lstWifiInfo.size() == 0) { - qCWarning(appLog) << "KLVGenerator::getNetworkInfoFromCatWifiInfo no wifi info"; - return; - } - QList >::const_iterator it = lstWifiInfo.begin(); - - for (; it != lstWifiInfo.end(); ++it) { - // qCDebug(appLog) << "KLVGenerator::getNetworkInfoFromCatWifiInfo process wifi info"; - if ((*it).size() < 3) { - // qCDebug(appLog) << "KLVGenerator::getNetworkInfoFromCatWifiInfo wifi info not enough"; - 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)) { - // qCDebug(appLog) << "KLVGenerator::getNetworkInfoFromCatWifiInfo fix chip type"; - tempMap["Chip Type"] = tempMap["Chip Type"].remove("HUAWEI").trimmed(); - } - - // 按照华为的需求,设置蓝牙制造商和类型 - tempMap["Vendor"] = "HISILICON"; - tempMap["Type"] = "Wireless network"; - - DeviceManager::instance()->setNetworkInfoFromWifiInfo(tempMap); - } - qCDebug(appLog) << "KLVGenerator::getNetworkInfoFromCatWifiInfo end"; -} - -void KLVGenerator::getDiskInfoFromLshw() -{ - qCDebug(appLog) << "KLVGenerator::getDiskInfoFromLshw start"; - QString bootdevicePath("/proc/bootdevice/product_name"); - QString modelStr = ""; - QFile file(bootdevicePath); - if (file.open(QIODevice::ReadOnly)) { - qCDebug(appLog) << "KLVGenerator::getDiskInfoFromLshw open bootdevice file success"; - modelStr = file.readLine().simplified(); - file.close(); - } else { - qCWarning(appLog) << "KLVGenerator::getDiskInfoFromLshw open bootdevice file failed"; - } - - const QList> lstDisk = DeviceManager::instance()->cmdInfo("lshw_disk"); - QList >::const_iterator dIt = lstDisk.begin(); - for (; dIt != lstDisk.end(); ++dIt) { - // qCDebug(appLog) << "KLVGenerator::getDiskInfoFromLshw process lshw disk info"; - if ((*dIt).size() < 2) { - // qCDebug(appLog) << "KLVGenerator::getDiskInfoFromLshw disk info not enough"; - continue; - } - - // KLU的问题特殊处理 - QMap tempMap; - foreach (const QString &key, (*dIt).keys()) { - tempMap.insert(key, (*dIt)[key]); - } - // qCDebug(appLog) << "KLVGenerator::getDiskInfoFromLshw disk product:" << tempMap["product"] << "modelStr:" << modelStr; -// qCInfo(appLog) << tempMap["product"] << " ***** " << modelStr << " " << (tempMap["product"] == modelStr); - // HW写死 - if (tempMap["product"] == modelStr) { - // qCDebug(appLog) << "KLVGenerator::getDiskInfoFromLshw find boot device"; - // 应HW的要求,将描述固定为 Universal Flash Storage - tempMap["description"] = "Universal Flash Storage"; - // 应HW的要求,添加interface UFS 3.1 - tempMap["interface"] = "UFS 3.1"; - } - - DeviceManager::instance()->addLshwinfoIntoStorageDevice(tempMap); - } - qCDebug(appLog) << "KLVGenerator::getDiskInfoFromLshw end"; -} - -void KLVGenerator::getImageInfoFromHwinfo() -{ - qCDebug(appLog) << "KLVGenerator::getImageInfoFromHwinfo start"; - // 加载从hwinfo中获取的图像设备信息 - const QList> &lstMap = DeviceManager::instance()->cmdInfo("hwinfo_usb"); - QList >::const_iterator it = lstMap.begin(); - for (; it != lstMap.end(); ++it) { - // qCDebug(appLog) << "KLVGenerator::getImageInfoFromHwinfo process hwinfo usb info"; - if ((*it).size() < 3) { - // qCDebug(appLog) << "KLVGenerator::getImageInfoFromHwinfo usb info not enough"; - 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") { - // qCDebug(appLog) << "KLVGenerator::getImageInfoFromHwinfo not camera device"; - 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")) { - // qCDebug(appLog) << "KLVGenerator::getImageInfoFromHwinfo is usb device"; - // 判断authorized是否存在,不存在则直接返回 - if (!QFile::exists("/sys" + path + "/authorized")) { - // qCDebug(appLog) << "KLVGenerator::getImageInfoFromHwinfo authorized file not exists, skip"; - continue; - } - } - - // 判断重复设备数据 - QString unique_id = uniqueID(tempMap); - DeviceImage *device = dynamic_cast(DeviceManager::instance()->getImageDevice(unique_id)); - if (device) { - // qCDebug(appLog) << "KLVGenerator::getImageInfoFromHwinfo device already exists, update it"; - device->setEnableValue(false); - device->setInfoFromHwinfo(tempMap); - continue; - } else { - if (tempMap.contains("path")) { - // qCDebug(appLog) << "KLVGenerator::getImageInfoFromHwinfo tempMap contains path, skip"; - continue; - } - } - - device = new DeviceImage(); - // qCDebug(appLog) << "KLVGenerator::getImageInfoFromHwinfo add image device"; - device->setInfoFromHwinfo(tempMap); - DeviceManager::instance()->addImageDevice(device); - addBusIDFromHwinfo(tempMap["SysFS BusID"]); - } - qCDebug(appLog) << "KLVGenerator::getImageInfoFromHwinfo end"; -} - -void KLVGenerator::getImageInfoFromLshw() -{ - qCDebug(appLog) << "KLVGenerator::getImageInfoFromLshw start"; - // 加载从lshw中获取的图像设备信息 - const QList> &lstMap = DeviceManager::instance()->cmdInfo("lshw_usb"); - QList >::const_iterator it = lstMap.begin(); - for (; it != lstMap.end(); ++it) { - // qCDebug(appLog) << "KLVGenerator::getImageInfoFromLshw process lshw usb info"; - if ((*it).size() < 2) { - // qCDebug(appLog) << "KLVGenerator::getImageInfoFromLshw usb info not enough"; - continue; - } - - QMap tempMap; - foreach (const QString &key, (*it).keys()) { - if ("vendor" != key) - tempMap.insert(key, (*it)[key]); - } - - DeviceManager::instance()->setCameraInfoFromLshw(tempMap); - // qCDebug(appLog) << "KLVGenerator::getImageInfoFromLshw set camera info"; - } - qCDebug(appLog) << "KLVGenerator::getImageInfoFromLshw end"; -} - 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 87e14d0ec..c6d1d5a13 100644 --- a/deepin-devicemanager/src/GenerateDevice/PanguxGenerator.cpp +++ b/deepin-devicemanager/src/GenerateDevice/PanguxGenerator.cpp @@ -123,7 +123,7 @@ void PanguXGenerator::generatorCpuDevice() for (int i = 0; i < lst.size(); i++) { // qCDebug(appLog) << "PanguXGenerator::generatorCpuDevice set cpu info"; DeviceBaseInfo *device = lst[i]; - DeviceManager::instance()->tomlDeviceSet(DT_Cpu, device,mapInfo); + DeviceManager::instance()->tomlDeviceMapSet(DT_Cpu, device,mapInfo); } qCDebug(appLog) << "PanguXGenerator::generatorCpuDevice end"; } 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 6b6e734f4..62de78cbb 100644 --- a/deepin-devicemanager/src/Page/PageBoardInfo.cpp +++ b/deepin-devicemanager/src/Page/PageBoardInfo.cpp @@ -69,8 +69,8 @@ void PageBoardInfo::updateInfo(const QList &lst) } // 获取主板信息并加载 - QList> baseInfoMap = board->getBaseAttribs(); - QList> otherInfoMap = board->getOtherAttribs(); + QList> baseInfoMap = board->getBaseTranslationAttribs(); + QList> otherInfoMap = board->getOtherTranslationAttribs(); baseInfoMap = baseInfoMap + otherInfoMap; loadDeviceInfo(lstOther, baseInfoMap); } @@ -186,7 +186,7 @@ void PageBoardInfo::getOtherInfoPair(const QList &lst, QList pair; - pair.first = bios->name(); + pair.first = bios->nameTr(); getValueInfo(bios, pair); lstPair.append(pair); } @@ -197,8 +197,8 @@ void PageBoardInfo::getValueInfo(DeviceBaseInfo *device, QPair { qCDebug(appLog) << "PageBoardInfo::getValueInfo start, device:" << device->name(); // 获取信息并保存为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 3e39d3c74..456fd55c8 100644 --- a/deepin-devicemanager/src/Page/PageDetail.cpp +++ b/deepin-devicemanager/src/Page/PageDetail.cpp @@ -225,7 +225,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()) { // qCDebug(appLog) << "PageDetail::showDeviceInfo is last device, hide seperator"; diff --git a/deepin-devicemanager/src/Page/PageSingleInfo.cpp b/deepin-devicemanager/src/Page/PageSingleInfo.cpp index dfb88217b..6a690cddb 100644 --- a/deepin-devicemanager/src/Page/PageSingleInfo.cpp +++ b/deepin-devicemanager/src/Page/PageSingleInfo.cpp @@ -115,8 +115,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 c2439f50a..236bd31ed 100644 --- a/deepin-devicemanager/src/Widget/TextBrowser.cpp +++ b/deepin-devicemanager/src/Widget/TextBrowser.cpp @@ -70,7 +70,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); } @@ -98,11 +98,11 @@ 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) { qCDebug(appLog) << "Showing other info"; - const QList> &otherInfo = mp_Info->getOtherAttribs(); + const QList> &otherInfo = mp_Info->getOtherTranslationAttribs(); domTableInfo(doc, otherInfo); } } diff --git a/deepin-devicemanager/src/commondefine.h b/deepin-devicemanager/src/commondefine.h index dac7a48a8..6e4c9e8ef 100644 --- a/deepin-devicemanager/src/commondefine.h +++ b/deepin-devicemanager/src/commondefine.h @@ -6,6 +6,11 @@ #pragma once #include +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) +#include +#else +#include +#endif const QString commonFontFamily_ = "Noto Sans CJK TC"; const int leftDeviceListViewMinWidth_ = 177; @@ -19,3 +24,27 @@ const int contextMenuWidth_ = 150; #define GenerateTsItem 0 const QString DEVICEINFO_PATH = "/tmp/device-info"; + +// QString::SkipEmptyParts was moved to Qt::SkipEmptyParts in Qt6 +#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) +#define QT_SKIP_EMPTY_PARTS QString::SkipEmptyParts +#elif QT_VERSION < QT_VERSION_CHECK(6, 0, 0) +#define QT_SKIP_EMPTY_PARTS Qt::SplitBehaviorFlags(Qt::SkipEmptyParts) +#else +#define QT_SKIP_EMPTY_PARTS Qt::SkipEmptyParts +#endif + +// Regular expression compatibility macros for Qt5/Qt6 +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) +// Qt5 uses QRegExp +#define QT_REGEXP QRegExp +#define QT_REGEXP_MATCH(pattern, string) pattern.exactMatch(string) +#define QT_REGEXP_CAPTURE(pattern, index) pattern.cap(index) +#define QT_REGEXP_INDEX_IN(pattern, string) pattern.indexIn(string) +#else +// Qt6 uses QRegularExpression +#define QT_REGEXP QRegularExpression +#define QT_REGEXP_MATCH(pattern, string) pattern.match(string).hasMatch() +#define QT_REGEXP_CAPTURE(pattern, index, string) pattern.match(string).captured(index) +#define QT_REGEXP_INDEX_IN(pattern, string) pattern.match(string).hasMatch() ? 0 : -1 +#endif diff --git a/deepin-devicemanager/src/commonfunction.cpp b/deepin-devicemanager/src/commonfunction.cpp index 7de9a24f3..8110bab9d 100644 --- a/deepin-devicemanager/src/commonfunction.cpp +++ b/deepin-devicemanager/src/commonfunction.cpp @@ -211,6 +211,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*/, bool useEnv/* = true*/) { qCDebug(appLog) << "Executing command:" << cmd << "args:" << args; diff --git a/deepin-devicemanager/src/commonfunction.h b/deepin-devicemanager/src/commonfunction.h index 52e38d8ad..c7f8139cb 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..aae9f0066 100644 --- a/deepin-devicemanager/tests/src/DeviceManager/ut_devicemanager.cpp +++ b/deepin-devicemanager/tests/src/DeviceManager/ut_devicemanager.cpp @@ -258,19 +258,6 @@ TEST_F(UT_DeviceManager, UT_DeviceManager_setStorageDeviceMediaType) 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; -} - 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_zh_CN.ts b/deepin-devicemanager/translations/deepin-devicemanager_zh_CN.ts index b4c67ad94..d11052752 100644 --- a/deepin-devicemanager/translations/deepin-devicemanager_zh_CN.ts +++ b/deepin-devicemanager/translations/deepin-devicemanager_zh_CN.ts @@ -90,3650 +90,2390 @@ - DeviceAudio + DeviceBaseInfo - + Device Name 设备名称 - - - Name - 名称 - - - - + + Vendor 制造商 - + Chip 芯片 - - Capabilities - 功能 - - - - Module Alias - 模块别名 - - - + + Physical ID 物理ID - + SysFS_Path - SysFS_Path - - - - Description - 描述 + - + Revision - 修订版本 + - + KernelModeDriver - KernelModeDriver - - - - Memory Address - 内存地址 + - + IRQ 中断 - - Unavailable - 不可用 - - - + Disable 禁用 - - - DeviceBaseInfo - - - Name - 名称 - - - Vendor - 制造商 - - - - Model - 型号 - - - - DeviceBios - - - Vendor - 制造商 - - - + Version 版本 - + Chipset 芯片组 - - - DeviceBluetooth - - - Alias - 别名 - - - - Name - 名称 - - - - Vendor - 制造商 - - - - Version - 版本 - - - - Model - 型号 - - + Module Alias 模块别名 - - Physical ID - 物理ID - - - + Speed 速度 - + Maximum Power 最大功率 - - Driver Version - 驱动版本 - - - + Driver 驱动 - + + Driver Version + 驱动版本 + + + Capabilities 功能 - - Bus Info - 总线信息 + + logical name + 逻辑名称 - + Logical Name 逻辑名称 - + MAC Address 物理地址 - - Unavailable - 不可用 - - - - Disable - 禁用 - - - - DeviceCdrom - - - Name - 名称 - - - - Vendor - 制造商 - - - - Model - 型号 - - - - Version - 版本 - - - - Bus Info - 总线信息 - - - - Capabilities - 功能 - - - - Driver - 驱动 - - - - Maximum Power - 最大功率 - - - - Speed - 速度 - - - - Module Alias - 模块别名 - - - - Physical ID - 物理ID - - - - Unavailable - 不可用 - - - - Disable - 禁用 - - - - DeviceComputer - - - Name - 名称 - - - - DeviceCpu - - - - Name - 名称 - - - - - Vendor - 制造商 - - - + CPU ID 处理器ID - + Core ID 核心ID - + Threads 线程数 - + BogoMIPS 运行速度(Bogomips) - - + Architecture 架构 - + CPU Family 家族 - - Model - 型号 - - - - + + Processor 逻辑处理器 - + Core(s) - + Virtualization 虚拟化 - + Flags 特性 - + Extensions 扩展指令集 - - L4 Cache - L4 缓存 - - - + L3 Cache L3缓存 - + + L4 Cache + L4缓存 + + + L2 Cache L2缓存 - + L1i Cache L1缓存(指令) - + L1d Cache L1缓存(数据) - + Stepping 步进 - - Speed - 频率 - - - - + + + Max Speed 最大频率 - - - DeviceGpu - - - Name - 名称 - - - - Vendor - 制造商 - - - - Model - 型号 - - - - Version - 版本 - - + Graphics Memory 显存 - - Module Alias - 模块别名 - - - - Physical ID - 物理ID - - - + Memory Address 内存地址 - + IO Port I/O端口 - - Bus Info - 总线信息 - - - + Maximum Resolution 最大分辨率 - + Minimum Resolution 最小分辨率 - - Current Resolution - 当前分辨率 - - - - Driver - 驱动 - - - + Description 描述 - + DP DP - + eDP eDP - + HDMI HDMI - + VGA VGA - + DVI DVI - + DigitalOutput DigitalOutput - + Display Output 显示输出 - + Capabilities 功能 - - IRQ - 中断 + + Interface + 接口 - - Unavailable - 不可用 + + Bus Info + 总线信息 - - - DeviceImage - - Name - 名称 + + bus info + 总线信息 - - Vendor - 制造商 + + Maximum Current + 最大电流 - - Version - 版本 + + Unavailable + 不可用 - - Model - 型号 + + Type + 类型 - - Bus Info - 总线信息 + + Total Width + 总位宽 - - Module Alias - 模块别名 + + Locator + 插槽 - - Physical ID - 物理ID + + Configured Voltage + 配置电压 - - Speed - 速度 + + Maximum Voltage + 最高电压 - - Maximum Power - 最大功率 - - - - Driver - 驱动 + + Minimum Voltage + 最低电压 - - Capabilities - 功能 + + Configured Speed + 配置速度 - - Serial Number - 序列号 + + Data Width + 数据位宽 - - Unavailable - 不可用 + + Display Input + 显示输入 - - Disable - 禁用 + + Interface Type + 接口类型 - - - DeviceInput - - Name - 名称 + + Support Resolution + 支持分辨率 - - Vendor - 制造商 + + Current Resolution + 当前分辨率 - - Model - 型号 + + Refresh Rate + 刷新率 - - Interface - 接口 + + Display Ratio + 显示比例 - - Bus Info - 总线信息 + + Primary Monitor + 主显示器 - - Module Alias - 模块别名 + + Size + 大小 - - Physical ID - 物理ID + + Maximum Rate + 最大速率 - - Speed - 频率 + + Negotiation Rate + 协商速率 - - Maximum Current - 最大电流 + + Port + 端口 - - Driver - 驱动 + + Multicast + 组播 - - Capabilities - 功能 + + Link + 连接 - - Version - 版本 + + Latency + 延迟 - - Unavailable - 不可用 + + IP + IP - - Disable - 禁用 + + Firmware + 固件 - - - DeviceManager - - - - - - - - - - - Overview - 概况 + + Duplex + 双工 - - - - CPU - 处理器 + + Broadcast + 广播 - - - CPU quantity - CPU数量 + + Auto Negotiation + 自动协商 - - - Motherboard - 主板 + + Input/Output + 输入/输出 - - + Memory 内存 - - - Display Adapter - 显示适配器 + + Model + 型号 - - - Sound Adapter - 音频适配器 + + Status + 状态 - - - Storage - 存储设备 + + Capacity + 最大容量 - - - Other PCI Devices - 其他PCI设备 + + Voltage + 电压 - - - Battery - 电池 + + Slot + 插槽 - - - Bluetooth - 蓝牙 + + Design Capacity + 设计容量 - - - Network Adapter - 网络适配器 + + Design Voltage + 设计电压 - - - Mouse - 鼠标 + + SBDS Version + SBDS版本 - - - Keyboard - 键盘 + + SBDS Serial Number + SBDS序列号 - - - Monitor - 显示设备 + + SBDS Manufacture Date + SBDS制造日期 - - - CD-ROM - 光驱 + + SBDS Chemistry + SBDS材料 - - - Printer - 打印机 + + Temperature + 温度 - - - Camera - 图像设备 + + Name + 名称 - - - Other Devices - Other Input Devices - 其他设备 + + Shared + 已共享 - - - - Device - 设备 + + URI + URI - - - - OS - 操作系统 + + Media Type + 介质类型 - - - DeviceMemory - - - Name - 名称 + + Firmware Version + 固件版本 - - - Vendor - 制造商 + + Serial Number + 序列号 - - - Size - 大小 + + Rotation Rate + 转速 - - - Type - 类型 + + SubVendor + 子制造商 - - - Speed - 速度 + + SubDevice + 子设备 - - Total Width - 总位宽 + + Driver Status + 驱动状态 - - Locator - 插槽 + + Driver Activation Cmd + 驱动激活命令 - - Serial Number - 序列号 + + Config Status + 配置状态 - - Configured Voltage - 配置电压 + + latency + 延迟 - - Maximum Voltage - 最高电压 + + Phys + Phys - - Minimum Voltage - 最低电压 + + Sysfs + Sysfs - - - Configured Speed - 配置频率 + + Handlers + 处理程序 - - Data Width - 数据位宽 + + PROP + PROP - - - DeviceMonitor - - Name - 名称 + + EV + EV - - Vendor - 制造商 + + KEY + KEY - - Type - 类型 + + Bus + 总线 - - Display Input - 显示输入 + + BIOS Information + BIOS信息 - - Interface Type - 接口类型 + + Base Board Information + 主板信息 - - Support Resolution - 支持分辨率 + + System Information + 系统信息 - - Current Resolution - 当前分辨率 + + Chassis Information + 机箱信息 - - Display Ratio - 显示比例 + + Physical Memory Array + 内存插槽信息 - - Primary Monitor - 主显示器 + + Release Date + 发布日期 - - Size - 大小 + + Address + 地址 - - Serial Number - 序列号 + + Runtime Size + 运行内存大小 - - - DeviceNetwork - - - Name - 名称 + + ROM Size + ROM大小 - - - Vendor - 制造商 + + Characteristics + 特性 - - - Type - 类型 + + BIOS Revision + BIOS修订版本 - - Version - 版本 + + Firmware Revision + 固件修订版本 - - Bus Info - 总线信息 + + Product Name + 产品名称 - - Capabilities - 功能 + + Asset Tag + 资产编号 - - Driver - 驱动 + + Features + 特征 - - Driver Version - 驱动版本 + + Location In Chassis + 机箱内位置 - - Module Alias - 模块别名 + + Chassis Handle + 机箱程序 - - Physical ID - 物理ID + + Type + 类型 - - Maximum Rate - 最大速率 + + Contained Object Handles + 包含对象程序 - - Negotiation Rate - 协商速率 + + UUID + UUID - - Port - 端口 + + Wake-up Type + 唤醒类型 - - Multicast - 组播 + + SKU Number + SKU号 - - Link - 连接 + + Family + 家族 - - Latency - 延迟 + + Lock + - - IP - IP + + Boot-up State + 开机状态 - - Firmware - 固件 + + Power Supply State + 供电状态 - - Duplex - 双工 + + Thermal State + 散热状态 - - Broadcast - 广播 + + Security Status + 安全状态 - - Auto Negotiation - 自动协商 + + OEM Information + OEM信息 - - Memory Address - 内存地址 + + Height + 高度 - - IRQ - 中断 + + Number Of Power Cords + 电源线数 - - MAC Address - 物理地址 + + Contained Elements + 包含组件数 - - Logical Name - 逻辑名称 + + Location + 位置 - - Unavailable - 不可用 + + Error Correction Type + 纠错类型 - - Disable - 禁用 + + Maximum Capacity + 最大容量 - - - DeviceOtherPCI - - Name - 名称 + + Error Information Handle + 错误信息程序 - - Vendor - 制造商 + + Number Of Devices + 卡槽数量 - - Model - 型号 + + BIOS ROMSIZE + BIOS ROM大小 - - Bus Info - 总线信息 + + Release date + 发布日期 - - Version - 版本 + + Board name + 主板名称 - - Input/Output - 输入/输出 + + SMBIOS Version + SMBIOS版本 - - Memory - 内存 + + Language Description Format + 语言描述格式 - - IRQ - 中断 + + Installable Languages + 可安装语言数 - - Latency - 延迟 + + Currently Installed Language + 当前安装语言 - - Driver - 驱动 + + BD Address + 蓝牙设备地址 - - Capabilities - 功能 + + ACL MTU + ACL MTU - - - DeviceOthers - - Name - 名称 + + SCO MTU + SCO MTU - - Vendor - 制造商 + + Packet type + 数据包类型 - - Model - 型号 + + Link policy + 连接策略 - - Version - 版本 + + Link mode + 连接模式 - - Bus Info - 总线信息 + + Class + 类别 - - Capabilities - 功能 + + Service Classes + 服务类别 - - Driver - 驱动 + + Device Class + 设备类别 - - Maximum Power - 最大功率 + + HCI Version + HCI版本 - - Speed - 速度 + + LMP Version + LMP版本 - - Serial Number - 序列号 + + Subversion + 子版本 - - Unavailable - 不可用 + + Device + 设备 - - Disable - 禁用 + + Serial ID + 序列号 - - - DevicePower - - Name - 名称 + + product + 产品 - - Model - 型号 + + description + 描述 - - Vendor - 制造商 + + Powered + 供电 - - Serial Number - 序列号 + + Discoverable + 可发现 - - Type - 类型 + + Pairable + 可配对 - - Status - 状态 + + Modalias + 设置命令别名 - - Capacity - 最大容量 + + Discovering + 搜索中 - - Voltage - 电压 + + Device File + 设备文件 - - Slot - 插槽 + + Device Files + 设备文件 - - Design Capacity - 设计容量 + + Device Number + 设备编号 - - Design Voltage - 设计电压 + + Application + 应用 - - SBDS Version - SBDS版本 + + status + 状态 - - SBDS Serial Number - SBDS序列号 + + logical name + 逻辑地址 - - SBDS Manufacture Date - SBDS制造日期 + + ansiversion + ANSI版本 - - SBDS Chemistry - SBDS材料 + + CPU implementer + CPU程序 - - Temperature - 温度 + + CPU architecture + CPU架构 - - - DevicePrint - - Name - 名称 + + CPU variant + CPU变量 - - Model - 型号 + + CPU part + CPU部件 - - Vendor - 制造商 + + CPU revision + CPU版本 - - Serial Number - 序列号 + + GDDR capacity + GDDR容量 - - Shared - 已共享 + + GPU vendor + GPU供应商 - - URI - URI + + GPU type + GPU类型 - - Status - 状态 + + EGL version + EGL版本 - - Interface Type - 接口类型 + + EGL client APIs + EGL接口 - - Disable - 禁用 + + GL version + GL版本 - - - DeviceStorage - - - Vendor - 制造商 + + GLSL version + GLSL版本 - - - Media Type - 介质类型 + + + + Unknown + 未知 - - - Size - 大小 + + Uniq + Uniq - - - Name - 名称 + + MSC + MSC - - Version - 版本 + + + + Hardware Class + 硬件类别 - - Capabilities - 功能 + + Array Handle + 数组程序 - - Module Alias - 模块别名 + + Form Factor + 尺寸型号 - - Physical ID - 物理ID + + Set + 设置 - - Firmware Version - 固件版本 + + Bank Locator + 内存通道 - - Speed - 速度 + + Part Number + 部件号码 - - Description - 描述 + + Rank + 位列 - - Serial Number - 序列号 + + Memory Technology + 内存技术 - - Interface - 接口 + + Memory Operating Mode Capability + 内存操作模式 - - Rotation Rate - 转速 + + Firmware Version + 固件版本 - - Unavailable - 不可用 + + Module Manufacturer ID + 组件制造商 - - - GetDriverNameWidget - - - Select a driver for update - 选择需要更新的驱动程序 + + Module Product ID + 组件产品ID - - No drivers found in this folder - 所选文件夹未检测到驱动文件 + + Memory Subsystem Controller Manufacturer ID + 内存子系统控制器制造商 - - - GetInfoPool - - Loading Audio Device Info... - 获取音频设备信息... + + Memory Subsystem Controller Product ID + 内存子系统控制器产品ID - - Loading BIOS Info... - 获取BIOS信息... + + Non-Volatile Size + 不易丢失大小 - - Loading CD-ROM Info... - 获取光驱信息... + + Volatile Size + 易丢失大小 - - Loading Operating System Info... - 获取操作系统信息... + + Cache Size + 缓存大小 - - Loading CPU Info... - 获取处理器信息... + + Logical Size + 逻辑大小 - - Loading Other Devices Info... - 获取其他设备信息... + + inch + 英寸 - - Loading Power Info... - 获取电池信息... + + Date + 日期 - - Loading Printer Info... - 获取打印机信息... + + ioport + I/O端口 - - Loading Mouse Info... - 获取鼠标信息... + + network + 网络 - - Loading Network Adapter Info... - 获取网络适配器信息... + + battery + 电池 - - - LogTreeView - - - - Disable - 禁用 + + native-path + 安装路径 - - Unavailable - 不可用 + + power supply + 供电 - - - LogViewItemDelegate - - Disable - 禁用 + + updated + 更新时间 - - Unavailable - 不可用 + + has history + 历史记录 - - - MainWindow - - Device Info - export file's name - 设备信息 + + has statistics + 用电统计 - - Display shortcuts - 显示快捷键 + + rechargeable + 可再充电 - - Close - 关闭 + + state + 状态 - - Help - 帮助 + + warning-level + 警告等级 - - Copy - 复制 + + energy + 容量 - - System - 系统 + + energy-empty + 最低容量 - - Export - 导出 + + energy-full + 完全充满容量 - - Refresh - 刷新 + + energy-full-design + 设计容量 - - Device Manager - 设备管理器 + + energy-rate + 能量密度 - - Hardware - 硬件信息 + + voltage + 电压 - - Drivers - 驱动管理 + + percentage + 电量 - - Monitor - 显示设备 + + technology + 电池技术 - - Overview - 概况 + + icon-name + 图标 - - Display Adapter - 显示适配器 + + online + 在线 - - CPU - 处理器 + + daemon-version + Daemon版本 - - Network Adapter - 网络适配器 + + on-battery + 使用电池 - - Battery - 电池 + + lid-is-closed + 笔记本合盖 - - - PageDetail - - More - 更多 + + lid-is-present + 打开笔记本盖子 - - - PageDriverBackupInfo - - - Name - 名称 + + critical-action + 电量极低时执行 - - - Current Version - 当前版本 + + copies + 复印数量 - - - Driver Platform Version - 驱动平台版本 + + job-cancel-after + 此时取消打印任务 - - Status - 状态 + + job-hold-until + 保留打印任务直至 - - Action - 操作 + + job-priority + 任务优先级 - - Backupable Drivers - 可备份驱动 + + marker-change-time + 标记修改次数 - - Backed up Drivers - 已备份驱动 + + number-up + 编号 - - - PageDriverControl - - - Updating - 正在更新 + + orientation-requested + 打印方向 - - - - Cancel - button - 取 消 + + print-color-mode + 颜色模式 - - Next - 下一步 + + printer-is-accepting-jobs + 当前可打印 - - Warning - 注意 + + printer-is-shared + 打印机已共享 - - The device will be unavailable after the driver uninstallation - 将从系统中卸载此驱动程序,卸载后该设备不可用 + + printer-is-temporary + 临时打印机 - - Uninstall - button - 卸 载 + + printer-make-and-model + 制造商和型号 - - Uninstalling - 正在卸载 + + printer-state-change-time + 打印机状态修改时间 - - Update successful - 驱动更新成功 + + printer-state-reasons + 打印机状态信息 - - Uninstallation successful - 驱动卸载成功 + + printer-type + 打印机类型 - - Update failed - 驱动更新失败 + + printer-uri-supported + 支持的URI - - Uninstallation failed - 驱动卸载失败 + + sides + 打印面数 - - OK - button - 确 定 + + + + SSD + 固态 - - Next - button - 下一步 + + + HDD + 机械 - - The selected folder does not exist, please select again - 所选文件夹不存在,请重新选择 + + bus info + 总线信息 - - Update - button - 更 新 + + logicalsectorsize + 逻辑分区大小 - - Previous - button - 上一步 + + sectorsize + 扇区大小 - - Broken package - 包文件损坏 + + guid + 全局唯一标识符 - - Unmatched package architecture - 包文件与系统架构不匹配 + + Geometry (Logical) + 几何数据(逻辑) + + + DeviceManager - - - 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 the device - 禁用失败 - - - - Failed to disable it: unable to get the device SN - 无法获取设备序列号,禁用失败 - - - - Update Drivers - 更新驱动 - - - - Uninstall Drivers - 卸载驱动 - - - - PageOverview - - - Refresh - 刷新 - - - - Export - 导出 - - - - Copy - 复制 - - - + + + + + + + + + + Overview 概况 - - - PageSingleInfo - - Refresh - 刷新 - - - - Export - 导出 - - - - Copy - 复制 - - - - - Enable - 启用 - - - - Update drivers - 更新驱动 - - - - Uninstall drivers - 卸载驱动 - - - - Allow it to wake the computer - 允许唤起电脑 - - - - Disable - 禁用 - - - - - Failed to disable it: unable to get the device SN - 无法获取设备序列号,禁用失败 - - - - Failed to disable the device - 禁用失败 - - - - Failed to enable the device - 启用失败 - - - - Update Drivers - 更新驱动 - - - - Uninstall Drivers - 卸载驱动 - - - - QObject - - - - SubVendor - 子制造商 - - - - - SubDevice - 子设备 - - - - Driver - 驱动 - - - - Driver Status - 驱动状态 - - - - Driver Activation Cmd - 驱动激活命令 - - - - - - - Config Status - 配置状态 - - - - - latency - 延迟 - - - - Phys - Phys - - - - Sysfs - Sysfs - - - - Handlers - 处理程序 - - - - - PROP - PROP - - - - - EV - EV - - - - - KEY - KEY - - - - Version - 版本 - - - - - - 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 - 产品名称 - - - - - - Serial Number - 序列号 - - - - - - Asset Tag - 资产编号 - - - - - Features - 特征 - - - - Location In Chassis - 机箱内位置 - - - - Chassis Handle - 机箱程序 - - - - - Type - 类型 - - - - 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 - 产品 - - - - description - 描述 - - - - Powered - 供电 - - - - Discoverable - 可发现 - - - - Pairable - 可配对 - - - - Modalias - 设置命令别名 - - - - Discovering - 搜索中 - - - - - Driver Modules - 驱动模块 - - - - - - - - Device File - 设备文件 - - - - Device Files - 设备文件 - - - - - - Device Number - 设备编号 - - - - Application - 应用 - - - - status - 状态 - - - - - - logical name - 逻辑地址 - - - - - ansiversion - ANSI版本 - - - - CPU implementer - CPU程序 - - - - CPU architecture - CPU架构 - - - - CPU variant - CPU变量 - - - - CPU part - CPU部件 - - - - CPU revision - CPU版本 - - - - 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 - 四十八 + + + + CPU + 处理器 - - Fifty - 五十 + + + CPU quantity + CPU数量 - - Fifty-two - 五十二 + + + Motherboard + 主板 - - Fifty-four - 五十四 + + + Memory + 内存 - - Fifty-six - 五十六 + + + Display Adapter + 显示适配器 - - Fifty-eight - 五十八 + + + Sound Adapter + 音频适配器 - - Sixty - 六十 + + + Storage + 存储设备 - - Sixty-two - 六十二 + + + Other PCI Devices + 其他PCI设备 - - Sixty-four - 六十四 + + + Battery + 电池 - - Sixty-six - 六十六 + + + Bluetooth + 蓝牙 - - Sixty-eight - 六十八 + + + Network Adapter + 网络适配器 - - Seventy - 七十 + + + Mouse + 鼠标 - - Seventy-two - 七十二 + + + Keyboard + 键盘 - - Seventy-four - 七十四 + + + Monitor + 显示设备 - - Seventy-six - 七十六 + + + CD-ROM + 光驱 - - Seventy-eight - 七十八 + + + Printer + 打印机 - - Eighty - 八十 + + + Camera + 图像设备 - - Eighty-two - 八十二 + + + Other Devices + Other Input Devices + 其他设备 - - Eighty-four - 八十四 + + + + Device + 设备 - - Eighty-six - 八十六 + + + + OS + 操作系统 + + + GetDriverNameWidget - - Eighty-eight - 八十八 + + + Select a driver for update + 选择需要更新的驱动程序 - - Ninety - 九十 + + No drivers found in this folder + 所选文件夹未检测到驱动文件 + + + GetInfoPool - - Ninety-two - 九十二 + + Loading Audio Device Info... + 获取音频设备信息... - - Ninety-four - 九十四 + + Loading BIOS Info... + 获取BIOS信息... - - Ninety-six - 九十六 + + Loading CD-ROM Info... + 获取光驱信息... - - Ninety-eight - 九十八 + + Loading Operating System Info... + 获取操作系统信息... - - One hundred - 一百 + + Loading CPU Info... + 获取处理器信息... - - One hundred and Two - 一百零二 + + Loading Other Devices Info... + 获取其他设备信息... - - One hundred and four - 一百零四 + + Loading Power Info... + 获取电池信息... - - One hundred and Six - 一百零六 + + Loading Printer Info... + 获取打印机信息... - - One hundred and Eight - 一百零八 + + Loading Mouse Info... + 获取鼠标信息... - - One hundred and Ten - 一百一十 + + Loading Network Adapter Info... + 获取网络适配器信息... + + + LogTreeView - - One hundred and Twelve - 一百一十二 + + + + Disable + 禁用 - - One hundred and Fourteen - 一百一十四 + + Unavailable + 不可用 + + + LogViewItemDelegate - - One hundred and Sixteen - 一百一十六 + + Disable + 禁用 - - One hundred and Eighteen - 一百一十八 + + Unavailable + 不可用 + + + MainWindow - - One hundred and Twenty - 一百二十 + + Device Info + export file's name + 设备信息 - - One hundred and Twenty-two - 一百二十二 + + Display shortcuts + 显示快捷键 - - One hundred and Twenty-four - 一百二十四 + + Close + 关闭 - - One hundred and Twenty-six - 一百二十六 + + Help + 帮助 - - One hundred and Twenty-eight - 一百二十八 + + Copy + 复制 - - One hundred and Ninety-two - 一百九十二 + + System + 系统 - - Two hundred and fifty-six - 二百五十六 + + Export + 导出 - - GDDR capacity - GDDR容量 + + Refresh + 刷新 - - GPU vendor - GPU供应商 + + Device Manager + 设备管理器 - - GPU type - GPU类型 + + Hardware + 硬件信息 - - EGL version - EGL版本 + + Drivers + 驱动管理 - - EGL client APIs - EGL接口 + + Monitor + 显示设备 - - GL version - GL版本 + + Overview + 概况 - - GLSL version - GLSL版本 + + Display Adapter + 显示适配器 - - - - Unknown - 未知 + + CPU + 处理器 - - Uniq - Uniq + + Network Adapter + 网络适配器 - - MSC - MSC + + Battery + 电池 + + + PageDetail - - - - Hardware Class - 硬件类别 + + More + 更多 + + + PageDriverBackupInfo - - - - - CPU - 处理器 + + + Name + 名称 - - - - - No CPU found - 未发现处理器 + + + Current Version + 当前版本 - - - - - Motherboard - 主板 + + + Driver Platform Version + 驱动平台版本 - - - - - No motherboard found - 未发现主板 + + Status + 状态 - - - - - Memory - 内存 + + Action + 操作 - - - - - No memory found - 未发现内存 + + Backupable Drivers + 可备份驱动 - - - - - Storage - 存储设备 + + Backed up Drivers + 已备份驱动 + + + PageDriverControl - - - - - No disk found - 未发现磁盘 + + + Updating + 正在更新 - - Driver restore failed! - 驱动还原失败! + + + + Cancel + button + 取 消 - - - Please try again or give us feedback - 请重试,或反馈给我们 + + Next + 下一步 - - Driver backup failed! - 驱动备份失败! + + Warning + 注意 - - - - - - Display Adapter - 显示适配器 + + The device will be unavailable after the driver uninstallation + 将从系统中卸载此驱动程序,卸载后该设备不可用 - - - - - No GPU found - 未发现GPU + + Uninstall + button + 卸 载 - - - - - Monitor - 显示设备 + + Uninstalling + 正在卸载 - - - - - No monitor found - 未发现显示设备 + + Update successful + 驱动更新成功 - - - - - - Network Adapter - 网络适配器 + + Uninstallation successful + 驱动卸载成功 - - - - - No network adapter found - 未发现网络适配器 + + Update failed + 驱动更新失败 - - - - - - Sound Adapter - 音频适配器 + + Uninstallation failed + 驱动卸载失败 - - - - - No audio device found - 未发现音频设备 + + OK + button + 确 定 - - - - - - Bluetooth - 蓝牙 + + Next + button + 下一步 - - - - - - No Bluetooth device found - 未发现蓝牙设备 + + + The selected folder does not exist, please select again + 所选文件夹不存在,请重新选择 - - - - - Other PCI Devices - 其他PCI设备 + + Update + button + 更 新 - - - - - No other PCI devices found - 未发现其他PCI设备 + + Previous + button + 上一步 - - - - - Power - 电池 + + Broken package + 包文件损坏 - - - - - No battery found - 未发现电池 + + Unmatched package architecture + 包文件与系统架构不匹配 - - - - - - Keyboard - 键盘 + + + The selected file does not exist, please select again + 所选文件不存在,请重新选择 - - - - - No keyboard found - 未发现键盘 + + It is not a driver + 该文件不是驱动文件 - - - - - - Mouse - 鼠标 + + Unable to install - no digital signature + 无法安装,安装包无数字签名 - - - - - No mouse found - 未发现鼠标 + + Unknown error + 未知错误 - - - - - - Printer - 打印机 + + The driver module was not found + 未发现该驱动模块 - - - - - No printer found - 未发现打印机 + + Invalid module format + 模块格式无效 - - - - - Camera - 图像设备 + + The driver module has dependencies + 驱动模块被依赖 + + + PageDriverInstallInfo - - - - - No camera found - 未发现图像设备 + + + + Device Name + 设备名称 - - - - - CD-ROM - 光驱 + + Version Available + 可安装版本 - - - - - No CD-ROM found - 未发现光驱 + + + Size + 大小 - - - - - - - Other Devices - 其他设备 + + + Status + 状态 - - - - - No other devices found - 未发现其他设备 + + + Action + 操作 - - Array Handle - 数组程序 + + New Version + 可更新版本 - - Form Factor - 尺寸型号 + + Current Version + 当前版本 - - Set - 设置 + + Missing drivers (%1) + 可安装驱动 (%1) - - Bank Locator - 内存通道 + + Outdated drivers (%1) + 可更新驱动 (%1) - - Type Detail - 类型详情 + + Up-to-date drivers (%1) + 无需更新驱动 (%1) + + + PageDriverManager - - Part Number - 部件号码 + + + + Driver Install + 驱动安装 - - Rank - 位列 + + + + + Driver Backup + 驱动备份 - - Memory Technology - 内存技术 + + + Driver Restore + 驱动还原 - - Memory Operating Mode Capability - 内存操作模式 + + OK + 确 定 - - Firmware Version - 固件版本 + + Feedback + 反馈 + + + PageDriverRestoreInfo - - Module Manufacturer ID - 组件制造商 + + You do not have any drivers to restore, please backup first + 您没有驱动可以还原,请先备份 - - Module Product ID - 组件产品ID + + Go to Backup Driver + 前往备份驱动 - - Memory Subsystem Controller Manufacturer ID - 内存子系统控制器制造商 + + Name + 名称 - - Memory Subsystem Controller Product ID - 内存子系统控制器产品ID + + Current Version + 当前版本 - - Non-Volatile Size - 不易丢失大小 + + Backup Version + 备份版本 - - Volatile Size - 易丢失大小 + + Action + 操作 - - Cache Size - 缓存大小 + + Restorable Drivers + 可还原驱动 + + + PageListView - - Logical Size - 逻辑大小 + + Refresh + 刷新 - - - - - - - - inch - 英寸 + + Export + 导出 - - Date - 日期 + + Overview + 概况 - - ioport - I/O端口 + + Driver Install + 驱动安装 - - network - 网络 + + Driver Backup + 驱动备份 - - battery - 电池 + + Driver Restore + 驱动还原 + + + PageMultiInfo - - native-path - 安装路径 + + Failed to enable the device + 启用失败 - - power supply - 供电 + + Failed to disable the device + 禁用失败 - - updated - 更新时间 + + Failed to disable it: unable to get the device SN + 无法获取设备序列号,禁用失败 - - has history - 历史记录 + + Update Drivers + 更新驱动 - - has statistics - 用电统计 + + Uninstall Drivers + 卸载驱动 + + + PageOverview - - rechargeable - 可再充电 + + Refresh + 刷新 - - state - 状态 + + Export + 导出 - - warning-level - 警告等级 + + Copy + 复制 - - energy - 容量 + + Overview + 概况 + + + PageSingleInfo - - energy-empty - 最低容量 + + Refresh + 刷新 - - energy-full - 完全充满容量 + + Export + 导出 - - energy-full-design - 设计容量 + + Copy + 复制 - - energy-rate - 能量密度 + + + Enable + 启用 - - voltage - 电压 + + Update drivers + 更新驱动 - - percentage - 电量 + + Uninstall drivers + 卸载驱动 - - technology - 电池技术 + + Allow it to wake the computer + 允许唤起电脑 - - icon-name - 图标 + + Disable + 禁用 - - online - 在线 + + + Failed to disable it: unable to get the device SN + 无法获取设备序列号,禁用失败 - - daemon-version - Daemon版本 + + Failed to disable the device + 禁用失败 - - on-battery - 使用电池 + + Failed to enable the device + 启用失败 - - lid-is-closed - 笔记本合盖 + + Update Drivers + 更新驱动 - - lid-is-present - 打开笔记本盖子 + + Uninstall Drivers + 卸载驱动 + + + QObject - - critical-action - 电量极低时执行 + + + + + CPU + 处理器 - - copies - 复印数量 + + + + + No CPU found + 未发现处理器 - - job-cancel-after - 此时取消打印任务 + + + + + Motherboard + 主板 - - job-hold-until - 保留打印任务直至 + + + + + No motherboard found + 未发现主板 - - job-priority - 任务优先级 + + + + + Memory + 内存 - - marker-change-time - 标记修改次数 + + + + + No memory found + 未发现内存 - - number-up - 编号 + + Driver restore failed! + 驱动还原失败! - - orientation-requested - 打印方向 + + + Please try again or give us feedback + 请重试,或反馈给我们 - - print-color-mode - 颜色模式 + + Driver backup failed! + 驱动备份失败! - - printer-is-accepting-jobs - 当前可打印 + + + + + + Display Adapter + 显示适配器 - - printer-is-shared - 打印机已共享 + + + + + No GPU found + 未发现GPU - - printer-is-temporary - 临时打印机 + + + + + Monitor + 显示设备 - - printer-make-and-model - 制造商和型号 + + + + + No monitor found + 未发现显示设备 - - printer-state-change-time - 打印机状态修改时间 + + + + + + Keyboard + 键盘 - - printer-state-reasons - 打印机状态信息 + + + + + No keyboard found + 未发现键盘 - - printer-type - 打印机类型 + + + + + + Mouse + 鼠标 - - printer-uri-supported - 支持的URI + + + + + No mouse found + 未发现鼠标 - - sides - 打印面数 + + + + + + Printer + 打印机 - - - - - - - SSD - 固态 + + + + + No printer found + 未发现打印机 - - - HDD - 机械 + + + + + Camera + 图像设备 - - - bus info - 总线信息 + + + + + No camera found + 未发现图像设备 - - logicalsectorsize - 逻辑分区大小 + + + + + CD-ROM + 光驱 - - sectorsize - 扇区大小 + + + + + No CD-ROM found + 未发现光驱 - - guid - 全局唯一标识符 + + + + + + + Other Devices + 其他设备 - - Geometry (Logical) - 几何数据(逻辑) + + + + + No other devices found + 未发现其他设备 @@ -3988,12 +2728,20 @@ - + Cancel button 取 消 + + + + + Cancel + button + 取 消 + You are backing up drivers, which will be interrupted if you exit. @@ -4130,13 +2878,368 @@ Restore 还原 + + + Install + 安装 + + + + 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) + + + + + Processor + 逻辑处理器 + Install 安装 - + Overview 概况 @@ -4171,13 +3274,12 @@ - Allow it to wake the computer + Allow it to wake computer 允许唤起电脑 - Enable 启用