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
45 changes: 26 additions & 19 deletions deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,27 +96,32 @@ void DeviceMonitor::setInfoFromHwinfo(const QMap<QString, QString> &mapInfo)
setAttribute(mapInfo, "", m_DisplayInput);
setAttribute(mapInfo, "Size", m_ScreenSize);
setAttribute(mapInfo, "", m_MainScreen);
// setAttribute(mapInfo, "Resolution", m_SupportResolution);
if (Common::specialComType > 0){
setAttribute(mapInfo, "Resolution", m_SupportResolution);
}

double inch = 0.0;
QSize size(0, 0);
QString inchValue = parseMonitorSize(m_ScreenSize, inch, size);
m_ScreenSize = inchValue;

// 获取当前分辨率 和 当前支持分辨率
// QStringList listResolution = m_SupportResolution.split(" ");
// m_SupportResolution = "";
// foreach (const QString &word, listResolution) {
// if (word.contains("@")) {
// m_SupportResolution.append(word);
// m_SupportResolution.append(", ");
// }
// }
if (Common::specialComType > 0){
QStringList listResolution = m_SupportResolution.split(" ");
m_SupportResolution = "";
foreach (const QString &word, listResolution) {
if (word.contains("@")) {
m_SupportResolution.append(word);
m_SupportResolution.append(", ");
}
}
}

// 计算显示比例
caculateScreenRatio();

// m_SupportResolution.replace(QRegExp(", $"), "");
if (Common::specialComType > 0){
m_SupportResolution.replace(QRegExp(", $"), "");
}

m_ProductionWeek = transWeekToDate(mapInfo["Year of Manufacture"], mapInfo["Week of Manufacture"]);
setAttribute(mapInfo, "Serial ID", m_SerialNumber);
Expand Down Expand Up @@ -207,17 +212,19 @@ bool DeviceMonitor::setInfoFromXradr(const QString &main, const QString &edid, c
}
}

QMap<QString, QStringList> monitorResolutionMap = getMonitorResolutionMap(xrandr, m_RawInterface);
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);
m_SupportResolution.append(", ");
if (monitorResolutionMap.size() == 1) {
m_SupportResolution.clear();
foreach (const QString &word, monitorResolutionMap.value(m_RawInterface)) {
if (word.contains("@")) {
m_SupportResolution.append(word);
m_SupportResolution.append(", ");
}
}
m_SupportResolution.replace(QRegExp(", $"), "");
}
m_SupportResolution.replace(QRegExp(", $"), "");
}
return false;
}
Expand Down
14 changes: 8 additions & 6 deletions deepin-devicemanager/src/Page/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -524,12 +524,14 @@ void MainWindow::slotLoadingFinish(const QString &message)
mp_DeviceWidget->updateDevice(mp_DeviceWidget->currentIndex(), lst);

// bug-325731
if (mp_DeviceWidget->currentIndex() == QObject::tr("Monitor")) {
QtConcurrent::run([=](){
QThread::msleep(700);
emit mp_DeviceWidget->itemClicked(mp_DeviceWidget->currentIndex());
qWarning() << mp_DeviceWidget->currentIndex();
});
if (Common::specialComType <= 0) {
if (mp_DeviceWidget->currentIndex() == QObject::tr("Monitor")) {
QtConcurrent::run([=](){
QThread::msleep(700);
emit mp_DeviceWidget->itemClicked(mp_DeviceWidget->currentIndex());
qWarning() << mp_DeviceWidget->currentIndex();
});
}
}
} else {
QMap<QString, QString> overviewMap = DeviceManager::instance()->getDeviceOverview();
Expand Down
1 change: 0 additions & 1 deletion deepin-devicemanager/src/Tool/ThreadExecXrandr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,6 @@ void ThreadExecXrandr::loadXrandrVerboseInfo(QList<QMap<QString, QString>> &lstM

// 获取当前频率
if ((*it).contains("*current")) {
// QString ss = *it;
if ((it += 2) >= lines.end())
return;
QRegExp regRate(".*([0-9]{1,5}\\.[0-9]{1,5}Hz).*");
Expand Down