mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-25 05:52:50 -05:00
Implement some data smoothing
This commit is contained in:
@@ -71,7 +71,7 @@ Column {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
||||
StyledText {
|
||||
text: DankgopService.cpuUsage.toFixed(1) + "%"
|
||||
text: DankgopService.smoothedCpuUsage.toFixed(1) + "%"
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
font.weight: Font.Bold
|
||||
color: Theme.primary
|
||||
|
||||
@@ -62,10 +62,10 @@ Rectangle {
|
||||
name: DankgopService.getProcessIcon(process ? process.command : "")
|
||||
size: Theme.iconSize - 4
|
||||
color: {
|
||||
if (process && process.cpu > 80)
|
||||
if (process && process.smoothedCpu > 80)
|
||||
return Theme.error
|
||||
|
||||
if (process && process.cpu > 50)
|
||||
if (process && process.smoothedCpu > 50)
|
||||
return Theme.warning
|
||||
|
||||
return Theme.surfaceText
|
||||
@@ -95,10 +95,10 @@ Rectangle {
|
||||
height: 20
|
||||
radius: Theme.cornerRadius
|
||||
color: {
|
||||
if (process && process.cpu > 80)
|
||||
if (process && process.smoothedCpu > 80)
|
||||
return Qt.rgba(Theme.error.r, Theme.error.g, Theme.error.b, 0.12)
|
||||
|
||||
if (process && process.cpu > 50)
|
||||
if (process && process.smoothedCpu > 50)
|
||||
return Qt.rgba(Theme.warning.r, Theme.warning.g,
|
||||
Theme.warning.b, 0.12)
|
||||
|
||||
@@ -110,15 +110,15 @@ Rectangle {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
||||
StyledText {
|
||||
text: DankgopService.formatCpuUsage(process ? process.cpu : 0)
|
||||
text: DankgopService.formatCpuUsage(process ? process.smoothedCpu : 0)
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
font.family: SettingsData.monoFontFamily
|
||||
font.weight: Font.Bold
|
||||
color: {
|
||||
if (process && process.cpu > 80)
|
||||
if (process && process.smoothedCpu > 80)
|
||||
return Theme.error
|
||||
|
||||
if (process && process.cpu > 50)
|
||||
if (process && process.smoothedCpu > 50)
|
||||
return Theme.warning
|
||||
|
||||
return Theme.surfaceText
|
||||
|
||||
@@ -57,9 +57,9 @@ Row {
|
||||
|
||||
StyledText {
|
||||
text: {
|
||||
if (DankgopService.cpuUsage === undefined || DankgopService.cpuUsage === null)
|
||||
if (DankgopService.smoothedCpuUsage === undefined || DankgopService.smoothedCpuUsage === null)
|
||||
return "--%"
|
||||
return DankgopService.cpuUsage.toFixed(1) + "%"
|
||||
return DankgopService.smoothedCpuUsage.toFixed(1) + "%"
|
||||
}
|
||||
font.pixelSize: Theme.fontSizeLarge
|
||||
font.family: SettingsData.monoFontFamily
|
||||
|
||||
@@ -59,10 +59,10 @@ Rectangle {
|
||||
name: "memory"
|
||||
size: Theme.iconSize - 8
|
||||
color: {
|
||||
if (DankgopService.cpuUsage > 80)
|
||||
if (DankgopService.smoothedCpuUsage > 80)
|
||||
return Theme.tempDanger
|
||||
|
||||
if (DankgopService.cpuUsage > 60)
|
||||
if (DankgopService.smoothedCpuUsage > 60)
|
||||
return Theme.tempWarning
|
||||
|
||||
return Theme.surfaceText
|
||||
@@ -72,12 +72,12 @@ Rectangle {
|
||||
|
||||
StyledText {
|
||||
text: {
|
||||
if (DankgopService.cpuUsage === undefined
|
||||
|| DankgopService.cpuUsage === null
|
||||
|| DankgopService.cpuUsage === 0) {
|
||||
if (DankgopService.smoothedCpuUsage === undefined
|
||||
|| DankgopService.smoothedCpuUsage === null
|
||||
|| DankgopService.smoothedCpuUsage === 0) {
|
||||
return "--%"
|
||||
}
|
||||
return DankgopService.cpuUsage.toFixed(0) + "%"
|
||||
return DankgopService.smoothedCpuUsage.toFixed(0) + "%"
|
||||
}
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
font.weight: Font.Medium
|
||||
|
||||
Reference in New Issue
Block a user