Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion deepin-devicemanager/src/DeviceManager/DeviceCpu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,8 @@ void DeviceCpu::setCpuInfo(const QMap<QString, QString> &mapLscpu, const QMap<QS

if (Common::specialComType == Common::kSpecialType5 ||
Common::specialComType == Common::kSpecialType6 ||
Common::specialComType == Common::kSpecialType7) {
Common::specialComType == Common::kSpecialType7 ||
Common::specialComType == Common::kSpecialType9) {
m_Frequency = m_Frequency.replace("2.189", "2.188");
m_MaxFrequency = m_MaxFrequency.replace("2189", "2188");
}
Expand Down
39 changes: 26 additions & 13 deletions deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ void DeviceMonitor::setInfoFromHwinfo(const QMap<QString, QString> &mapInfo)
TomlFixMethod DeviceMonitor::setInfoFromTomlOneByOne(const QMap<QString, QString> &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;
// 添加基本信息
Expand Down Expand Up @@ -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);
Expand All @@ -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);
}
Expand All @@ -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) {
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion deepin-devicemanager/src/GenerateDevice/HWGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}

Expand Down
12 changes: 6 additions & 6 deletions deepin-devicemanager/src/commonfunction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: The mapping from SpecialComputerType to boardVendorKey doesn’t cover all enum values; verify that the default case is correct for the new types.

In checkBoardVendorFlag, NormalCom, kSpecialType1..5, and kSpecialType8 are handled explicitly, but kSpecialType6, kSpecialType7, and kSpecialType9 fall through to the default (empty key). Since kSpecialType9 is used in device-specific branches elsewhere, consider adding explicit cases (or clearly documenting that these share the default behavior) to avoid unintended configuration differences.

boardVendorKey = "CustomType";
break;
default:
Expand Down Expand Up @@ -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;
}
Expand Down
11 changes: 6 additions & 5 deletions deepin-devicemanager/src/commonfunction.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
2 changes: 1 addition & 1 deletion deepin-devicemanager/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ int main(int argc, char *argv[])
}

// 特殊机型,提前缓存GPU信息
if (Common::specialComType == Common::kCustomType) {
if (Common::specialComType == Common::kSpecialType8) {
CommonTools::preGenerateGpuInfo();
}

Expand Down