1212import Cocoa
1313import Kit
1414
15- internal class Preview : NSStackView , Preview_v {
15+ internal class Preview : PreviewWrapper {
1616 private var initialized : Bool = false
1717 private var initializedAverage : Bool = false
1818 private var initializedFrequency : Bool = false
@@ -28,23 +28,23 @@ internal class Preview: NSStackView, Preview_v {
2828
2929 private var eCoresColor : NSColor {
3030 let color = SColor . teal
31- let key = Store . shared. string ( key: " CPU_eCoresColor " , defaultValue: color. key)
31+ let key = Store . shared. string ( key: " \( self . module . stringValue ) _eCoresColor " , defaultValue: color. key)
3232 if let c = SColor . fromString ( key) . additional as? NSColor {
3333 return c
3434 }
3535 return color. additional as! NSColor
3636 }
3737 private var pCoresColor : NSColor {
3838 let color = SColor . indigo
39- let key = Store . shared. string ( key: " CPU_pCoresColor " , defaultValue: color. key)
39+ let key = Store . shared. string ( key: " \( self . module . stringValue ) _pCoresColor " , defaultValue: color. key)
4040 if let c = SColor . fromString ( key) . additional as? NSColor {
4141 return c
4242 }
4343 return color. additional as! NSColor
4444 }
4545 private var sCoresColor : NSColor {
4646 let color = SColor . orange
47- let key = Store . shared. string ( key: " CPU_sCoresColor " , defaultValue: color. key)
47+ let key = Store . shared. string ( key: " \( self . module . stringValue ) _sCoresColor " , defaultValue: color. key)
4848 if let c = SColor . fromString ( key) . additional as? NSColor {
4949 return c
5050 }
@@ -68,17 +68,8 @@ internal class Preview: NSStackView, Preview_v {
6868
6969 private var cores : [ CoreView ] = [ ]
7070
71- private var loadLineChartHistory : Int = 180
72- private var loadLineChartScale : Scale = . none
73- private var loadLineChartFixedScale : Double = 1
74-
7571 public init ( _ module: ModuleType ) {
76- super. init ( frame: NSRect . zero)
77-
78- self . orientation = . vertical
79- self . distribution = . gravityAreas
80- self . translatesAutoresizingMaskIntoConstraints = false
81- self . spacing = Constants . Settings. margin
72+ super. init ( type: module)
8273
8374 self . addArrangedSubview ( PreferencesSection ( [ self . totalView ( ) ] ) )
8475 self . addArrangedSubview ( PreferencesSection ( label: localizedString ( " Usage history " ) , [ self . historyView ( ) ] ) )
@@ -175,7 +166,7 @@ internal class Preview: NSStackView, Preview_v {
175166 view. spacing = Constants . Settings. margin*2
176167 view. heightAnchor. constraint ( equalToConstant: 140 ) . isActive = true
177168
178- let chart = LineChartView ( num: self . loadLineChartHistory , scale : self . loadLineChartScale , fixedScale : self . loadLineChartFixedScale )
169+ let chart = LineChartView ( num: 600 )
179170 chart. setColor ( self . chartColor)
180171 chart. setLegend ( x: true , y: true )
181172 self . loadLineChart = chart
0 commit comments