From afcc16dc5782b3fa66d35aa78283cb4de40f1548 Mon Sep 17 00:00:00 2001 From: gongheng Date: Tue, 31 Mar 2026 14:34:21 +0800 Subject: [PATCH] Feat: Add group setting to show screen size. -- Add group setting to show screen size. Log: add feature Task: https://pms.uniontech.com/task-view-387965.html --- .../src/DeviceManager/DeviceMonitor.cpp | 31 ++++++++++--------- deepin-devicemanager/src/commonfunction.cpp | 12 +++++++ deepin-devicemanager/src/commonfunction.h | 2 ++ 3 files changed, 30 insertions(+), 15 deletions(-) diff --git a/deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp b/deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp index 3c41bf16..d967f598 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp @@ -8,7 +8,6 @@ #include "commonfunction.h" #include -#include // Qt库文件 #include @@ -301,14 +300,23 @@ QString DeviceMonitor::subTitle() const QString DeviceMonitor::getOverviewInfo() { QString ov; - if (Common::specialComType == Common::kSpecialType6 || - Common::specialComType == Common::kSpecialType7 || - Common::specialComType == Common::kSpecialType9) { - ov = QString("(%1)").arg(m_ScreenSize); + if (Common::isShowScreenSize()) { + 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); + } } else { - ov = QString("%1(%2)").arg(m_Name).arg(m_ScreenSize); + if (Common::specialComType == Common::kSpecialType6 || + Common::specialComType == Common::kSpecialType7 || + Common::specialComType == Common::kSpecialType9) { + ov = ""; + } else { + ov = QString("%1").arg(m_Name); + } } - return ov; } @@ -351,14 +359,7 @@ void DeviceMonitor::loadOtherDeviceInfo() } } addOtherDeviceInfo(("Primary Monitor"), m_MainScreen); - bool showScreenSize { true }; -#ifdef DTKCORE_CLASS_DConfigFile - DConfig *dconfig = DConfig::create("org.deepin.devicemanager","org.deepin.devicemanager"); - if(dconfig && dconfig->isValid() && dconfig->keyList().contains("showScreenSize")){ - showScreenSize = dconfig->value("showScreenSize").toBool(); - } -#endif - if (showScreenSize) + if (Common::isShowScreenSize()) addOtherDeviceInfo(("Size"), m_ScreenSize); addOtherDeviceInfo(("Serial Number"), m_SerialNumber); // addOtherDeviceInfo(("Product Date"), m_ProductionWeek); diff --git a/deepin-devicemanager/src/commonfunction.cpp b/deepin-devicemanager/src/commonfunction.cpp index 471befcb..a207311f 100644 --- a/deepin-devicemanager/src/commonfunction.cpp +++ b/deepin-devicemanager/src/commonfunction.cpp @@ -239,3 +239,15 @@ QByteArray Common::executeClientCmd(const QString &cmd, const QStringList &args, } return outPut; } + +bool Common::isShowScreenSize() +{ + bool showScreenSize { true }; +#ifdef DTKCORE_CLASS_DConfigFile + DConfig *dconfig = DConfig::create("org.deepin.devicemanager","org.deepin.devicemanager"); + if(dconfig && dconfig->isValid() && dconfig->keyList().contains("showScreenSize")){ + showScreenSize = dconfig->value("showScreenSize").toBool(); + } +#endif + return showScreenSize; +} diff --git a/deepin-devicemanager/src/commonfunction.h b/deepin-devicemanager/src/commonfunction.h index 414fdac2..e315db89 100644 --- a/deepin-devicemanager/src/commonfunction.h +++ b/deepin-devicemanager/src/commonfunction.h @@ -54,5 +54,7 @@ class Common static SpecialCpuType curCpuType; static QByteArray executeClientCmd(const QString& cmd, const QStringList& args = QStringList(), const QString& workPath = QString(), int msecsWaiting = 30000); + + static bool isShowScreenSize(); }; #endif // COMMONFUNCTION_H