Skip to content

Commit 45b3cf6

Browse files
GongHeng2017deepin-bot[bot]
authored andcommitted
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
1 parent 0b99531 commit 45b3cf6

3 files changed

Lines changed: 26 additions & 12 deletions

File tree

deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -356,11 +356,18 @@ const QString DeviceMonitor::getOverviewInfo()
356356
{
357357
qCDebug(appLog) << "Getting monitor overview information";
358358
QString ov;
359-
360-
if (Common::specialComType == 6 || Common::specialComType == 7) {
361-
ov = QString("(%1)").arg(m_ScreenSize);
359+
if (Common::isShowScreenSize()) {
360+
if (Common::specialComType == 6 || Common::specialComType == 7) {
361+
ov = QString("(%1)").arg(m_ScreenSize);
362+
} else {
363+
ov = QString("%1(%2)").arg(m_Name).arg(m_ScreenSize);
364+
}
362365
} else {
363-
ov = QString("%1(%2)").arg(m_Name).arg(m_ScreenSize);
366+
if (Common::specialComType == 6 || Common::specialComType == 7) {
367+
ov = "";
368+
} else {
369+
ov = QString("%1").arg(m_Name);
370+
}
364371
}
365372
qCDebug(appLog) << "Monitor overview:" << ov;
366373
return ov;
@@ -403,14 +410,7 @@ void DeviceMonitor::loadOtherDeviceInfo()
403410
}
404411
}
405412
addOtherDeviceInfo("Primary Monitor", m_MainScreen);
406-
bool showScreenSize { true };
407-
#ifdef DTKCORE_CLASS_DConfigFile
408-
DConfig *dconfig = DConfig::create("org.deepin.devicemanager","org.deepin.devicemanager");
409-
if(dconfig && dconfig->isValid() && dconfig->keyList().contains("showScreenSize")){
410-
showScreenSize = dconfig->value("showScreenSize").toBool();
411-
}
412-
#endif
413-
if (showScreenSize)
413+
if (Common::isShowScreenSize())
414414
addOtherDeviceInfo("Size", m_ScreenSize);
415415
addOtherDeviceInfo("Serial Number", m_SerialNumber);
416416
// addOtherDeviceInfo("Product Date", m_ProductionWeek);

deepin-devicemanager/src/commonfunction.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,3 +299,15 @@ QByteArray Common::executeClientCmd(const QString &cmd, const QStringList &args,
299299
}
300300
return outPut;
301301
}
302+
303+
bool Common::isShowScreenSize()
304+
{
305+
bool showScreenSize { true };
306+
#ifdef DTKCORE_CLASS_DConfigFile
307+
DConfig *dconfig = DConfig::create("org.deepin.devicemanager","org.deepin.devicemanager");
308+
if(dconfig && dconfig->isValid() && dconfig->keyList().contains("showScreenSize")){
309+
showScreenSize = dconfig->value("showScreenSize").toBool();
310+
}
311+
#endif
312+
return showScreenSize;
313+
}

deepin-devicemanager/src/commonfunction.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,5 +47,7 @@ class Common
4747
static int specialComType;
4848

4949
static QByteArray executeClientCmd(const QString& cmd, const QStringList& args = QStringList(), const QString& workPath = QString(), int msecsWaiting = 30000, bool useEnv = true);
50+
51+
static bool isShowScreenSize();
5052
};
5153
#endif // COMMONFUNCTION_H

0 commit comments

Comments
 (0)