Skip to content

Commit 74ca518

Browse files
committed
fix(device): replace specialComType check with isHwPlatform API
Refactor platform detection from Common::specialComType <= 0 to the new Common::isHwPlatform() method for improved code maintainability. Also fixes deprecated Qt::SkipEmptyParts → QString::SkipEmptyParts. Log: 统一使用isHwPlatform()替换specialComType平台判断 PMS: BUG-368321 Influence: 设备信息显示和分辨率获取的机型平台判断逻辑统一,代码更易维护。
1 parent 4ae9dfa commit 74ca518

5 files changed

Lines changed: 9 additions & 9 deletions

File tree

deepin-devicemanager/src/DeviceManager/DeviceComputer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd.
1+
// SPDX-FileCopyrightText: 2022 - 2026 UnionTech Software Technology Co., Ltd.
22
//
33
// SPDX-License-Identifier: GPL-3.0-or-later
44

@@ -198,7 +198,7 @@ void DeviceComputer::loadBaseDeviceInfo()
198198
{
199199
qCDebug(appLog) << "DeviceComputer::loadBaseDeviceInfo called.";
200200
// 添加基本信息
201-
addBaseDeviceInfo(("Name"), m_Name);
201+
addBaseDeviceInfo("Name", m_Name);
202202
}
203203

204204
void DeviceComputer::loadOtherDeviceInfo()

deepin-devicemanager/src/DeviceManager/DeviceMemory.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd.
1+
// SPDX-FileCopyrightText: 2022 - 2026 UnionTech Software Technology Co., Ltd.
22
//
33
// SPDX-License-Identifier: GPL-3.0-or-later
44

@@ -155,7 +155,7 @@ void DeviceMemory::loadBaseDeviceInfo()
155155
qCDebug(appLog) << "Loading base device info for memory";
156156
// 添加基本信息
157157
addBaseDeviceInfo("Name", m_Name);
158-
if (Common::specialComType <= 0) {
158+
if (!Common::isHwPlatform()) {
159159
addBaseDeviceInfo(("Vendor"), m_Vendor);
160160
}
161161
addBaseDeviceInfo("Size", m_Size);

deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ bool DeviceMonitor::setInfoFromXradr(const QString &main, const QString &edid, c
273273
}
274274
}
275275

276-
if (Common::specialComType <= 0) {
276+
if (!Common::isHwPlatform()) {
277277
QMap<QString, QStringList> monitorResolutionMap = getMonitorResolutionMap(xrandr, m_RawInterface);
278278

279279
if (monitorResolutionMap.size() == 1) {

deepin-devicemanager/src/DeviceManager/DeviceStorage.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ bool DeviceStorage::setHwinfoInfo(const QMap<QString, QString> &mapInfo)
154154
return false;
155155
}
156156

157-
if (Common::specialComType <= 0) {
157+
if (!Common::isHwPlatform()) {
158158
setAttribute(mapInfo, "Model", m_Name);
159159
}
160160
setAttribute(mapInfo, "Vendor", m_Vendor);
@@ -535,7 +535,7 @@ void DeviceStorage::appendDisk(DeviceStorage *device)
535535
void DeviceStorage::checkDiskSize()
536536
{
537537
qCDebug(appLog) << "DeviceStorage::checkDiskSize";
538-
if (Common::specialComType <= 0) {
538+
if (!Common::isHwPlatform()) {
539539
return; //定制机型专用,其它慎用
540540
}
541541
quint64 gbyte = 1000000000;
@@ -662,7 +662,7 @@ void DeviceStorage::loadBaseDeviceInfo()
662662
qCDebug(appLog) << "DeviceStorage::loadBaseDeviceInfo";
663663
// 添加基本信息
664664
addBaseDeviceInfo("Name", m_Name);
665-
if (Common::specialComType <= 0) {
665+
if (!Common::isHwPlatform()) {
666666
addBaseDeviceInfo(("Vendor"), m_Vendor);
667667
}
668668
addBaseDeviceInfo("Media Type", translateStr(m_MediaType));

deepin-devicemanager/src/Page/MainWindow.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,7 @@ void MainWindow::slotLoadingFinish(const QString &message)
578578
mp_DeviceWidget->updateDevice(mp_DeviceWidget->currentIndex(), lst);
579579

580580
// bug-325731
581-
if (Common::specialComType <= 0) {
581+
if (!Common::isHwPlatform()) {
582582
if (mp_DeviceWidget->currentIndex() == QObject::tr("Monitor")) {
583583
QtConcurrent::run([=](){
584584
QThread::msleep(700);

0 commit comments

Comments
 (0)