Skip to content

Commit a0b3b92

Browse files
SopwitCopilot
andcommitted
Fix refresh controls and virtualization label helper
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent ec6d25b commit a0b3b92

3 files changed

Lines changed: 82 additions & 49 deletions

File tree

src/backend/system/systeminfoprovider.cpp

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,35 @@
1414

1515
namespace {
1616

17+
QString virtualizationLabel(const QString &virtualization) {
18+
const QString normalized = virtualization.trimmed().toLower();
19+
if (normalized.isEmpty() || normalized == QStringLiteral("none")) {
20+
return {};
21+
}
22+
if (normalized == QStringLiteral("kvm")) {
23+
return QStringLiteral("KVM");
24+
}
25+
if (normalized == QStringLiteral("qemu")) {
26+
return QStringLiteral("QEMU");
27+
}
28+
if (normalized == QStringLiteral("vmware")) {
29+
return QStringLiteral("VMware");
30+
}
31+
if (normalized == QStringLiteral("oracle")) {
32+
return QStringLiteral("VirtualBox");
33+
}
34+
if (normalized == QStringLiteral("microsoft")) {
35+
return QStringLiteral("Hyper-V");
36+
}
37+
38+
QString label = virtualization.trimmed();
39+
if (label.isEmpty()) {
40+
return {};
41+
}
42+
label[0] = label[0].toUpper();
43+
return label;
44+
}
45+
1746
QString simplifiedDesktopName(const QString &desktop) {
1847
const QString trimmed = desktop.trimmed();
1948
if (trimmed.compare(QStringLiteral("KDE"), Qt::CaseInsensitive) == 0 ||

src/qml/pages/DriverPage.qml

Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -175,31 +175,6 @@ Item {
175175
font.weight: Font.DemiBold
176176
font.pixelSize: Math.round(12 * page.uiScale)
177177
}
178-
179-
ToolButton {
180-
id: refreshButton
181-
implicitWidth: Math.round(34 * page.uiScale)
182-
implicitHeight: Math.round(34 * page.uiScale)
183-
enabled: !page.nvidiaUpdater.busy && !page.nvidiaInstaller.busy
184-
display: AbstractButton.IconOnly
185-
ToolTip.visible: hovered
186-
ToolTip.text: qsTr("Rescan and check updates")
187-
onClicked: page.refreshDriverState(true)
188-
189-
contentItem: Image {
190-
source: "qrc:/qt/qml/rocontrol/assets/icon-refresh.svg"
191-
sourceSize.width: Math.round(17 * page.uiScale)
192-
sourceSize.height: Math.round(17 * page.uiScale)
193-
fillMode: Image.PreserveAspectFit
194-
}
195-
196-
background: Rectangle {
197-
radius: width / 2
198-
color: refreshButton.down ? page.infoBg : page.bgColor
199-
border.width: 1
200-
border.color: page.borderColor
201-
}
202-
}
203178
}
204179

205180
Label {
@@ -282,6 +257,33 @@ Item {
282257
font.pixelSize: Math.round(18 * page.uiScale)
283258
font.weight: Font.DemiBold
284259
}
260+
261+
ToolButton {
262+
id: refreshButton
263+
implicitWidth: Math.round(36 * page.uiScale)
264+
implicitHeight: Math.round(36 * page.uiScale)
265+
enabled: !page.nvidiaUpdater.busy && !page.nvidiaInstaller.busy
266+
display: AbstractButton.IconOnly
267+
ToolTip.visible: hovered
268+
ToolTip.text: qsTr("Rescan and check updates")
269+
onClicked: page.refreshDriverState(true)
270+
271+
contentItem: Image {
272+
source: "qrc:/qt/qml/rocontrol/assets/icon-refresh.svg"
273+
width: Math.round(20 * page.uiScale)
274+
height: Math.round(20 * page.uiScale)
275+
fillMode: Image.PreserveAspectFit
276+
smooth: true
277+
antialiasing: true
278+
}
279+
280+
background: Rectangle {
281+
radius: width / 2
282+
color: refreshButton.down ? page.infoBg : page.bgColor
283+
border.width: 1
284+
border.color: page.borderColor
285+
}
286+
}
285287
}
286288

287289
Label {

src/qml/pages/MonitorPage.qml

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -122,30 +122,6 @@ Item {
122122
font.weight: Font.DemiBold
123123
font.pixelSize: Math.round(12 * page.uiScale)
124124
}
125-
126-
ToolButton {
127-
id: telemetryRefreshButton
128-
implicitWidth: Math.round(34 * page.uiScale)
129-
implicitHeight: Math.round(34 * page.uiScale)
130-
display: AbstractButton.IconOnly
131-
ToolTip.visible: hovered
132-
ToolTip.text: qsTr("Refresh telemetry")
133-
onClicked: page.refreshTelemetry()
134-
135-
contentItem: Image {
136-
source: "qrc:/qt/qml/rocontrol/assets/icon-refresh.svg"
137-
sourceSize.width: Math.round(17 * page.uiScale)
138-
sourceSize.height: Math.round(17 * page.uiScale)
139-
fillMode: Image.PreserveAspectFit
140-
}
141-
142-
background: Rectangle {
143-
radius: width / 2
144-
color: telemetryRefreshButton.down ? page.infoBg : page.bgColor
145-
border.width: 1
146-
border.color: page.borderColor
147-
}
148-
}
149125
}
150126

151127
Label { text: page.ramMonitor ? page.ramMonitor.usagePercent + "%" : "--"; color: page.textColor; font.pixelSize: Math.round(22 * page.uiScale); font.weight: Font.DemiBold }
@@ -179,6 +155,32 @@ Item {
179155
font.pixelSize: Math.round(18 * page.uiScale)
180156
font.weight: Font.DemiBold
181157
}
158+
159+
ToolButton {
160+
id: telemetryRefreshButton
161+
implicitWidth: Math.round(36 * page.uiScale)
162+
implicitHeight: Math.round(36 * page.uiScale)
163+
display: AbstractButton.IconOnly
164+
ToolTip.visible: hovered
165+
ToolTip.text: qsTr("Refresh telemetry")
166+
onClicked: page.refreshTelemetry()
167+
168+
contentItem: Image {
169+
source: "qrc:/qt/qml/rocontrol/assets/icon-refresh.svg"
170+
width: Math.round(20 * page.uiScale)
171+
height: Math.round(20 * page.uiScale)
172+
fillMode: Image.PreserveAspectFit
173+
smooth: true
174+
antialiasing: true
175+
}
176+
177+
background: Rectangle {
178+
radius: width / 2
179+
color: telemetryRefreshButton.down ? page.infoBg : page.bgColor
180+
border.width: 1
181+
border.color: page.borderColor
182+
}
183+
}
182184
}
183185

184186
Label { text: qsTr("CPU"); color: page.softTextColor }

0 commit comments

Comments
 (0)