diff --git a/deepin-devicemanager/src/DeviceManager/DeviceCpu.cpp b/deepin-devicemanager/src/DeviceManager/DeviceCpu.cpp index 9e2b0b48..943ca73e 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceCpu.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceCpu.cpp @@ -125,7 +125,8 @@ void DeviceCpu::setCpuInfo(const QMap &mapLscpu, const QMap &mapInfo) TomlFixMethod DeviceMonitor::setInfoFromTomlOneByOne(const QMap &mapInfo) { qCDebug(appLog) << "Setting monitor info from TOML configuration"; - if (Common::specialComType == 2) + if (Common::specialComType == Common::kSpecialType2) m_IsTomlSet = true; TomlFixMethod ret = TOML_None; // 添加基本信息 @@ -357,7 +357,9 @@ const QString DeviceMonitor::getOverviewInfo() qCDebug(appLog) << "Getting monitor overview information"; QString ov; - if (Common::specialComType == 6 || Common::specialComType == 7) { + if (Common::specialComType == Common::kSpecialType6 || + Common::specialComType == Common::kSpecialType7 || + Common::specialComType == Common::kSpecialType9) { ov = QString("(%1)").arg(m_ScreenSize); } else { ov = QString("%1(%2)").arg(m_Name).arg(m_ScreenSize); @@ -376,11 +378,14 @@ void DeviceMonitor::loadBaseDeviceInfo() { qCDebug(appLog) << "Loading base device info for monitor"; // 添加基本信息 - if (Common::specialComType != 6 && Common::specialComType != 5) { - addBaseDeviceInfo("Name", m_Name); - addBaseDeviceInfo("Vendor", m_Vendor); - addBaseDeviceInfo("Type", m_Model); - addBaseDeviceInfo("Display Input", m_DisplayInput); + if (Common::specialComType != Common::kSpecialType5 && + Common::specialComType != Common::kSpecialType6 && + Common::specialComType != Common::kSpecialType7 && + Common::specialComType != Common::kSpecialType9) { + addBaseDeviceInfo(("Name"), m_Name); + addBaseDeviceInfo(("Vendor"), m_Vendor); + addBaseDeviceInfo(("Type"), m_Model); + addBaseDeviceInfo(("Display Input"), m_DisplayInput); } addBaseDeviceInfo("Interface Type", m_Interface); } @@ -391,9 +396,10 @@ void DeviceMonitor::loadOtherDeviceInfo() // 添加其他信息,成员变量 addOtherDeviceInfo("Support Resolution", m_SupportResolution); if (m_CurrentResolution != "@Hz") { - addOtherDeviceInfo("Current Resolution", m_CurrentResolution); - addOtherDeviceInfo("Display Ratio", m_AspectRatio); - if (Common::specialComType == 4) { + addOtherDeviceInfo(("Current Resolution"), m_CurrentResolution); + addOtherDeviceInfo(("Display Ratio"), m_AspectRatio); + + if (Common::specialComType == Common::kSpecialType4) { if (m_CurrentResolution.contains("@")) { QStringList refreshList = m_CurrentResolution.split('@', QT_SKIP_EMPTY_PARTS); if (refreshList.size() == 2) { @@ -466,16 +472,23 @@ bool DeviceMonitor::setMainInfoFromXrandr(const QString &info, const QString &ra int pos = rateMatch.capturedStart(); if (pos > 0 && curRate.size() > pos && !Common::boardVendorType().isEmpty()) { qCDebug(appLog) << "Adjusting rate for board vendor type"; - if (Common::specialComType == 1) { + if (Common::specialComType == Common::kSpecialType1) { curRate = QString::number(ceil(curRate.left(pos).toDouble())) + ".00" + curRate.right(curRate.size() - pos); } else { curRate = QString::number(ceil(curRate.left(pos).toDouble())) + curRate.right(curRate.size() - pos); } } - if (Common::specialComType == 1 || Common::specialComType == 6) { + if (Common::specialComType == Common::kSpecialType1 || + Common::specialComType == Common::kSpecialType5 || + Common::specialComType == Common::kSpecialType6 || + Common::specialComType == Common::kSpecialType7 || + Common::specialComType == Common::kSpecialType9) { m_RefreshRate = QString("%1").arg(curRate); } - if (Common::specialComType == 5 || Common::specialComType == 6) { + if (Common::specialComType == Common::kSpecialType5 || + Common::specialComType == Common::kSpecialType6 || + Common::specialComType == Common::kSpecialType7 || + Common::specialComType == Common::kSpecialType9) { m_CurrentResolution = QString("%1").arg(match.captured(1)).replace("x", "×", Qt::CaseInsensitive); } else { m_CurrentResolution = QString("%1 @%2").arg(match.captured(1)).arg(curRate).replace("x", "×", Qt::CaseInsensitive); diff --git a/deepin-devicemanager/src/GenerateDevice/HWGenerator.cpp b/deepin-devicemanager/src/GenerateDevice/HWGenerator.cpp index 2df5fa20..7b1cad24 100644 --- a/deepin-devicemanager/src/GenerateDevice/HWGenerator.cpp +++ b/deepin-devicemanager/src/GenerateDevice/HWGenerator.cpp @@ -310,7 +310,7 @@ void HWGenerator::generatorDiskDevice() if (name.contains("SDINFDO4-256G",Qt::CaseInsensitive)) tempMap["Name"] = "nouse"; - if (Common::specialComType == 2) { + if (Common::specialComType == Common::kSpecialType2) { tempMap["Interface"] = "UFS"; } diff --git a/deepin-devicemanager/src/commonfunction.cpp b/deepin-devicemanager/src/commonfunction.cpp index 8cdd24e4..c720faf6 100644 --- a/deepin-devicemanager/src/commonfunction.cpp +++ b/deepin-devicemanager/src/commonfunction.cpp @@ -154,22 +154,22 @@ QString Common::checkBoardVendorFlag() case NormalCom: boardVendorKey = ""; break; - case PGUW: + case kSpecialType1: boardVendorKey = "PGUW"; break; - case KLVV: + case kSpecialType2: boardVendorKey = "KLVV"; break; - case KLVU: + case kSpecialType3: boardVendorKey = "KLVU"; break; - case PGUV: + case kSpecialType4: boardVendorKey = "PGUV"; break; case kSpecialType5: boardVendorKey = "PGUX"; break; - case kCustomType: + case kSpecialType8: boardVendorKey = "CustomType"; break; default: @@ -242,7 +242,7 @@ void Common::tomlFilesNameSet(const QString &name) bool Common::isHwPlatform() { - if (specialComType == Unknow || specialComType == NormalCom || specialComType == kCustomType) + if (specialComType == Unknow || specialComType == NormalCom || specialComType == kSpecialType8) return false; return true; } diff --git a/deepin-devicemanager/src/commonfunction.h b/deepin-devicemanager/src/commonfunction.h index c0df2adc..852bd94b 100644 --- a/deepin-devicemanager/src/commonfunction.h +++ b/deepin-devicemanager/src/commonfunction.h @@ -18,14 +18,15 @@ class Common enum SpecialComputerType{ Unknow = -1, NormalCom, - PGUW, - KLVV, - KLVU, - PGUV, + kSpecialType1, + kSpecialType2, + kSpecialType3, + kSpecialType4, kSpecialType5, kSpecialType6, kSpecialType7, - kCustomType + kSpecialType8, + kSpecialType9 }; static QString getArch(); diff --git a/deepin-devicemanager/src/main.cpp b/deepin-devicemanager/src/main.cpp index e734db89..76a9d064 100644 --- a/deepin-devicemanager/src/main.cpp +++ b/deepin-devicemanager/src/main.cpp @@ -145,7 +145,7 @@ int main(int argc, char *argv[]) } // 特殊机型,提前缓存GPU信息 - if (Common::specialComType == Common::kCustomType) { + if (Common::specialComType == Common::kSpecialType8) { CommonTools::preGenerateGpuInfo(); }