feat: 设置窗口、合并温度趋势图、UI优化
- 新增设置窗口(右键打开):无边框毛玻璃风格,温度告警开关,QSettings持久化 - 合并温度趋势图:多GPU多色折线,图例,Y轴刻度,填充区域,最新温度标注 - 显卡排序:核显在前独显在后(std::stable_sort by boot_vga) - 卡片优化:删除温度行和频率/功耗行,驱动名+版本两端对齐,高度压缩至78 - 弹窗优化:宽度480,右上角刷新图标替代底部按钮 - tooltip修复:删除自定义Rectangle tooltip改用标准ToolTip - 翻译更新:设置/常规设置/温度告警/温度趋势等
This commit is contained in:
@@ -12,6 +12,8 @@
|
||||
#include <QTextStream>
|
||||
#include <QRegularExpression>
|
||||
#include <QFileInfo>
|
||||
#include <QSettings>
|
||||
#include <algorithm>
|
||||
#include <QDateTime>
|
||||
#include <QDBusInterface>
|
||||
#include <QDBusMessage>
|
||||
@@ -25,7 +27,10 @@ GraphicsDriverApplet::GraphicsDriverApplet(QObject *parent)
|
||||
: DApplet(parent)
|
||||
, m_ready(false)
|
||||
, m_lastAlertTime(0)
|
||||
, m_tempAlertEnabled(true)
|
||||
{
|
||||
QSettings settings("deepin", "graphics-driver-applet");
|
||||
m_tempAlertEnabled = settings.value("tempAlertEnabled", true).toBool();
|
||||
}
|
||||
|
||||
GraphicsDriverApplet::~GraphicsDriverApplet()
|
||||
@@ -96,6 +101,20 @@ QStringList GraphicsDriverApplet::gpuProcesses() const
|
||||
return m_gpuProcesses;
|
||||
}
|
||||
|
||||
bool GraphicsDriverApplet::tempAlertEnabled() const
|
||||
{
|
||||
return m_tempAlertEnabled;
|
||||
}
|
||||
|
||||
void GraphicsDriverApplet::setTempAlertEnabled(bool enabled)
|
||||
{
|
||||
if (m_tempAlertEnabled == enabled) return;
|
||||
m_tempAlertEnabled = enabled;
|
||||
QSettings settings("deepin", "graphics-driver-applet");
|
||||
settings.setValue("tempAlertEnabled", enabled);
|
||||
emit tempAlertEnabledChanged();
|
||||
}
|
||||
|
||||
void GraphicsDriverApplet::refreshDeviceInfo()
|
||||
{
|
||||
detectGpus();
|
||||
@@ -168,6 +187,11 @@ void GraphicsDriverApplet::detectGpus()
|
||||
}
|
||||
}
|
||||
|
||||
// 排序:核显(isPrimary)排在前面
|
||||
std::stable_sort(m_gpus.begin(), m_gpus.end(), [](const GpuInfo &a, const GpuInfo &b) {
|
||||
return a.isPrimary > b.isPrimary;
|
||||
});
|
||||
|
||||
// 生成摘要信息
|
||||
QStringList parts;
|
||||
QStringList driverParts;
|
||||
@@ -555,6 +579,8 @@ void GraphicsDriverApplet::readGpuStats()
|
||||
// 温度告警:检测是否有 GPU 温度超过 80°C,30 秒内不重复告警
|
||||
void GraphicsDriverApplet::checkTempAlert()
|
||||
{
|
||||
if (!m_tempAlertEnabled) return;
|
||||
|
||||
qint64 now = QDateTime::currentSecsSinceEpoch();
|
||||
if (now - m_lastAlertTime < 30) return;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user