Skip to content
Merged
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
10 changes: 10 additions & 0 deletions deepin-devicemanager/src/DeviceManager/DeviceGpu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,16 @@ void DeviceGpu::setXrandrInfo(const QMap<QString, QString> &mapInfo)
m_CurrentResolution = mapInfo["curResolution"];
m_MaximumResolution = mapInfo["maxResolution"];

if (m_MinimumResolution.contains("1920") && m_MinimumResolution.contains("1080")) {
m_MinimumResolution.replace("1080", "1200");
Comment on lines +225 to +226
Copy link

Choose a reason for hiding this comment

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

suggestion: Resolution replacement logic is duplicated for multiple member variables.

Consider extracting the repeated replacement logic into a utility function to improve maintainability and reduce code duplication.

}
if (m_CurrentResolution.contains("1920") && m_CurrentResolution.contains("1080")) {
m_CurrentResolution.replace("1080", "1200");
}
if (m_MaximumResolution.contains("1920") && m_MaximumResolution.contains("1080")) {
m_MaximumResolution.replace("1080", "1200");
}

// 设置显卡支持的接口
if (mapInfo.find("HDMI") != mapInfo.end())
m_HDMI = mapInfo["HDMI"];
Expand Down
22 changes: 20 additions & 2 deletions deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,12 @@ void DeviceMonitor::setInfoFromHwinfo(const QMap<QString, QString> &mapInfo)
m_SupportResolution = "";
foreach (const QString &word, listResolution) {
if (word.contains("@")) {
m_SupportResolution.append(word);
if (word.contains("1920") && word.contains("1080")) {
QString newResolution = word;
m_SupportResolution.append(newResolution.replace("1080", "1200"));
} else {
m_SupportResolution.append(word);
}
m_SupportResolution.append(", ");
}
}
Expand Down Expand Up @@ -231,14 +236,23 @@ bool DeviceMonitor::setInfoFromXradr(const QString &main, const QString &edid, c
}
}

if (m_CurrentResolution.contains("1920") && m_CurrentResolution.contains("1080")) {
m_CurrentResolution.replace("1080", "1200");
}

if (Common::specialComType <= 0) {
QMap<QString, QStringList> monitorResolutionMap = getMonitorResolutionMap(xrandr, m_RawInterface);

if (monitorResolutionMap.size() == 1) {
m_SupportResolution.clear();
foreach (const QString &word, monitorResolutionMap.value(m_RawInterface)) {
if (word.contains("@")) {
m_SupportResolution.append(word);
if (word.contains("1920") && word.contains("1080")) {
QString newResolution = word;
m_SupportResolution.append(newResolution.replace("1080", "1200"));
} else {
m_SupportResolution.append(word);
}
m_SupportResolution.append(", ");
}
}
Expand Down Expand Up @@ -409,6 +423,10 @@ bool DeviceMonitor::setMainInfoFromXrandr(const QString &info, const QString &ra
m_CurrentResolution = QString("%1").arg(reScreenSize.cap(1)).replace("x", "×", Qt::CaseInsensitive);
}

if (m_CurrentResolution.contains("1920") && m_CurrentResolution.contains("1080")) {
m_CurrentResolution.replace("1080", "1200");
}

return true;
}

Expand Down