Skip to content

Commit

Permalink
Add a reset graph contextual menu to the temperature graph.
Browse files Browse the repository at this point in the history
  • Loading branch information
mikepj committed Feb 7, 2020
1 parent 13a3bbf commit f3f41f5
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions Data Miners/XRGTemperatureMiner.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
@property NSDate *fanCacheCreated;

- (void)setDataSize:(int)newNumSamples;
- (void)reset;
- (int)numberOfCPUs;

- (void)setCurrentTemperatures; // Tries 3 different methods of gathering temperature statistics.
Expand Down
7 changes: 7 additions & 0 deletions Data Miners/XRGTemperatureMiner.m
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,13 @@ - (instancetype)init {
return self;
}

- (void)reset {
int width = numSamples;

[self setDataSize:0];
[self setDataSize:width];
}

- (int)numberOfCPUs {
processor_cpu_load_info_t newCPUInfo;
kern_return_t kr;
Expand Down
9 changes: 9 additions & 0 deletions Graph Views/XRGTemperatureView.m
Original file line number Diff line number Diff line change
Expand Up @@ -392,12 +392,21 @@ - (NSMenu *)menuForEvent:(NSEvent *)theEvent {

[myMenu addItem:[NSMenuItem separatorItem]];

tMI = [[NSMenuItem allocWithZone:[NSMenu menuZone]] initWithTitle:@"Reset Graph" action:@selector(clearData:) keyEquivalent:@""];
[myMenu addItem:tMI];

[myMenu addItem:[NSMenuItem separatorItem]];

tMI = [[NSMenuItem allocWithZone:[NSMenu menuZone]] initWithTitle:@"Open XRG Temperature Preferences..." action:@selector(openTemperaturePreferences:) keyEquivalent:@""];
[myMenu addItem:tMI];

return myMenu;
}

- (void)clearData:(NSEvent *)theEvent {
[TemperatureMiner reset];
}

- (void)emptyEvent:(NSEvent *)theEvent {
}

Expand Down

0 comments on commit f3f41f5

Please sign in to comment.