mirror of
https://github.com/morgan9e/macos-stats
synced 2026-04-15 00:34:08 +09:00
feat: updated Disk portal view
This commit is contained in:
@@ -47,6 +47,8 @@ public class Portal: PortalWrapper {
|
||||
private var pCoresColor: NSColor { self.pCoresColorState.additional as? NSColor ?? NSColor.systemBlue }
|
||||
|
||||
public override func load() {
|
||||
self.loadColors()
|
||||
|
||||
let view = NSStackView()
|
||||
view.orientation = .horizontal
|
||||
view.distribution = .fillEqually
|
||||
@@ -70,6 +72,14 @@ public class Portal: PortalWrapper {
|
||||
detailsView.heightAnchor.constraint(equalTo: view.heightAnchor).isActive = true
|
||||
}
|
||||
|
||||
public func loadColors() {
|
||||
self.systemColorState = Color.fromString(Store.shared.string(key: "\(self.name)_systemColor", defaultValue: self.systemColorState.key))
|
||||
self.userColorState = Color.fromString(Store.shared.string(key: "\(self.name)_userColor", defaultValue: self.userColorState.key))
|
||||
self.idleColorState = Color.fromString(Store.shared.string(key: "\(self.name)_idleColor", defaultValue: self.idleColorState.key))
|
||||
self.eCoresColorState = Color.fromString(Store.shared.string(key: "\(self.name)_eCoresColor", defaultValue: self.eCoresColorState.key))
|
||||
self.pCoresColorState = Color.fromString(Store.shared.string(key: "\(self.name)_pCoresColor", defaultValue: self.pCoresColorState.key))
|
||||
}
|
||||
|
||||
private func charts() -> NSView {
|
||||
let view = NSStackView()
|
||||
view.orientation = .vertical
|
||||
@@ -145,7 +155,7 @@ public class Portal: PortalWrapper {
|
||||
var usagePerCore: [ColorValue] = []
|
||||
if let cores = SystemKit.shared.device.info.cpu?.cores, cores.count == value.usagePerCore.count {
|
||||
for i in 0..<value.usagePerCore.count {
|
||||
usagePerCore.append(ColorValue(value.usagePerCore[i], color: cores[i].type == .efficiency ? NSColor.systemTeal : NSColor.systemBlue))
|
||||
usagePerCore.append(ColorValue(value.usagePerCore[i], color: cores[i].type == .efficiency ? self.eCoresColor : self.pCoresColor))
|
||||
}
|
||||
} else {
|
||||
for i in 0..<value.usagePerCore.count {
|
||||
|
||||
Reference in New Issue
Block a user