Skip to content

Commit

Permalink
Fixed some uint warnings with NSInteger bombing. Window should be mov…
Browse files Browse the repository at this point in the history
…able with the background now.
  • Loading branch information
nwinter committed May 24, 2014
1 parent 58b32e3 commit 7456a51
Show file tree
Hide file tree
Showing 20 changed files with 70 additions and 66 deletions.
3 changes: 2 additions & 1 deletion Telepath/TPHUDWindowController.m
Expand Up @@ -321,7 +321,8 @@ - (void)setUpActivityBox {
}

- (IBAction)onActivityDetailChanged:(id)sender {
[[NSUserDefaults standardUserDefaults] setObject:self.activityDetailField.stringValue forKey:@"currentActivityDetail"];
NSString *detail = self.activityDetailField.stringValue;
[[NSUserDefaults standardUserDefaults] setObject:detail forKey:@"currentActivityDetail"];
[[NSUserDefaults standardUserDefaults] synchronize];
}

Expand Down
12 changes: 6 additions & 6 deletions Telepath/TPHUDWindowController.xib
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="4514" systemVersion="13A3017" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="5056" systemVersion="13D65" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<deployment defaultVersion="1080" identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="4514"/>
<plugIn identifier="com.apple.WebKitIBPlugin" version="3336"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="5056"/>
<plugIn identifier="com.apple.WebKitIBPlugin" version="5056"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="TPHUDWindowController">
Expand Down Expand Up @@ -572,7 +572,7 @@
<rect key="frame" x="1" y="1" width="240" height="244"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" setsMaxLayoutWidthAtFirstLayout="YES" translatesAutoresizingMaskIntoConstraints="NO" id="9k6-un-PZx" userLabel="TF - Artist">
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="9k6-un-PZx" userLabel="TF - Artist">
<rect key="frame" x="0.0" y="217" width="240" height="22"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" lineBreakMode="truncatingMiddle" sendsActionOnEndEditing="YES" alignment="center" title="Muse" placeholderString="" id="4Vx-Ed-tRb">
Expand All @@ -584,7 +584,7 @@
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" setsMaxLayoutWidthAtFirstLayout="YES" translatesAutoresizingMaskIntoConstraints="NO" id="r1E-KF-bhY" userLabel="TF - Song">
<rect key="frame" x="0.0" y="195" width="240" height="22"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" lineBreakMode="truncatingMiddle" sendsActionOnEndEditing="YES" alignment="center" title="Knights of Cydonia" placeholderString="" id="snB-de-a0p">
<textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="center" title="Knights of Cydonia" placeholderString="" id="snB-de-a0p">
<font key="font" metaFont="system" size="18"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
Expand Down Expand Up @@ -737,4 +737,4 @@
<resources>
<image name="WebcamDefaultImage" width="240" height="180"/>
</resources>
</document>
</document>
4 changes: 2 additions & 2 deletions Telepath/TPTracker.h
Expand Up @@ -26,8 +26,8 @@ extern NSString * const TPActivityHappiness;

@interface TPTracker : NSObject

@property (readonly) uint currentEvents;
@property (readonly) uint totalEvents;
@property (readonly) NSInteger currentEvents;
@property (readonly) NSInteger totalEvents;
@property NSTimeInterval cameraRecordingInterval;

@end
7 changes: 4 additions & 3 deletions Telepath/TPTracker.m
Expand Up @@ -39,8 +39,8 @@ @interface TPTracker ()
@property TPTrackerHappiness *trackerHappiness;

/* Event logging */
@property uint previousEvents;
@property (readwrite) uint totalEvents;
@property NSInteger previousEvents;
@property (readwrite) NSInteger totalEvents;
@property NSMutableArray *eventsToLog;

/* File state */
Expand Down Expand Up @@ -95,6 +95,7 @@ - (id)init
//NSTimeInterval cameraPreviewInterval = 1 / 10.0;
//NSTimeInterval cameraPreviewInterval = 1 / 3.0;
NSTimeInterval cameraPreviewInterval = 1; // / 3.0;
//NSLog(@"Would set up screen recording with recording interval %f and preview interval %f, but not recording screen right now", cameraRecordingInterval, cameraPreviewInterval);
self.trackerCamera = [[TPTrackerCamera alloc] initWithRecordingInterval:cameraRecordingInterval andPreviewInterval:cameraPreviewInterval];
self.trackerGitHub = [TPTrackerGitHub new];
self.trackerTrello = [TPTrackerTrello new];
Expand All @@ -119,7 +120,7 @@ - (id)init
return self;
}

- (uint)currentEvents {
- (NSInteger)currentEvents {
return self.totalEvents - self.previousEvents;
}

Expand Down
4 changes: 2 additions & 2 deletions Telepath/TPTrackerBrunchBuilds.h
Expand Up @@ -9,7 +9,7 @@
#import <Foundation/Foundation.h>

@interface TPTrackerBrunchBuilds : NSObject
@property (readonly) uint currentEvents;
@property (readonly) uint totalEvents;
@property (readonly) NSInteger currentEvents;
@property (readonly) NSInteger totalEvents;

@end
6 changes: 3 additions & 3 deletions Telepath/TPTrackerBrunchBuilds.m
Expand Up @@ -10,8 +10,8 @@
#import "TPTracker.h"

@interface TPTrackerBrunchBuilds ()
@property uint previousEvents;
@property (readwrite) uint totalEvents;
@property NSInteger previousEvents;
@property (readwrite) NSInteger totalEvents;

@end

Expand All @@ -33,7 +33,7 @@ - (id)init
return self;
}

- (uint)currentEvents {
- (NSInteger)currentEvents {
return self.totalEvents - self.previousEvents;
}

Expand Down
2 changes: 1 addition & 1 deletion Telepath/TPTrackerEmail.h
Expand Up @@ -13,6 +13,6 @@
#import <Foundation/Foundation.h>

@interface TPTrackerEmail : NSObject
@property (readonly) uint unreadEmails;
@property (readonly) NSInteger unreadEmails;

@end
2 changes: 1 addition & 1 deletion Telepath/TPTrackerEmail.m
Expand Up @@ -13,7 +13,7 @@
@interface TPTrackerEmail ()
@property NSTimer *pollTimer;
@property NSMutableString *veryBad;
@property (readwrite) uint unreadEmails;
@property (readwrite) NSInteger unreadEmails;

@end

Expand Down
12 changes: 6 additions & 6 deletions Telepath/TPTrackerGitHub.h
Expand Up @@ -18,11 +18,11 @@
#import <Foundation/Foundation.h>

@interface TPTrackerGitHub : NSObject
@property (readonly) uint currentCommits;
@property (readonly) uint totalCommits;
@property (readonly) uint currentAdditions;
@property (readonly) uint totalAdditions;
@property (readonly) uint currentDeletions;
@property (readonly) uint totalDeletions;
@property (readonly) NSInteger currentCommits;
@property (readonly) NSInteger totalCommits;
@property (readonly) NSInteger currentAdditions;
@property (readonly) NSInteger totalAdditions;
@property (readonly) NSInteger currentDeletions;
@property (readonly) NSInteger totalDeletions;

@end
24 changes: 12 additions & 12 deletions Telepath/TPTrackerGitHub.m
Expand Up @@ -15,12 +15,12 @@ @interface TPTrackerGitHub ()
@property NSString *gitHubUserName;
@property NSString *gitHubRepo;
@property NSString *gitHubToken;
@property uint previousCommits;
@property (readwrite) uint totalCommits;
@property uint previousAdditions;
@property (readwrite) uint totalAdditions;
@property uint previousDeletions;
@property (readwrite) uint totalDeletions;
@property NSInteger previousCommits;
@property (readwrite) NSInteger totalCommits;
@property NSInteger previousAdditions;
@property (readwrite) NSInteger totalAdditions;
@property NSInteger previousDeletions;
@property (readwrite) NSInteger totalDeletions;

@end

Expand Down Expand Up @@ -60,15 +60,15 @@ - (id)init
return self;
}

- (uint)currentCommits {
- (NSInteger)currentCommits {
return self.totalCommits - self.previousCommits;
}

- (uint)currentAdditions {
- (NSInteger)currentAdditions {
return self.totalAdditions - self.previousAdditions;
}

- (uint)currentDeletions {
- (NSInteger)currentDeletions {
return self.totalDeletions - self.previousDeletions;
}

Expand All @@ -88,9 +88,9 @@ - (void)pollGitHub:(NSTimer *)t {
//NSLog(@"Got %lu contributors: %@", [contributors count], contributors);
for(NSDictionary *contributor in contributors) {
if(![contributor[@"author"][@"login"] isEqualToString:self.gitHubUserName]) continue;
uint newTotalCommits = [contributor[@"total"] intValue];
uint newTotalAdditions = 0;
uint newTotalDeletions = 0;
NSInteger newTotalCommits = [contributor[@"total"] intValue];
NSInteger newTotalAdditions = 0;
NSInteger newTotalDeletions = 0;
for(NSDictionary *week in contributor[@"weeks"]) {
newTotalAdditions += [week[@"a"] intValue];
newTotalDeletions += [week[@"d"] intValue];
Expand Down
4 changes: 2 additions & 2 deletions Telepath/TPTrackerKeyboard.h
Expand Up @@ -10,6 +10,6 @@

@interface TPTrackerKeyboard : NSObject
@property (nonatomic, strong) NSArray *modifierKeys;
@property (readonly) uint currentEvents;
@property (readonly) uint totalEvents;
@property (readonly) NSInteger currentEvents;
@property (readonly) NSInteger totalEvents;
@end
10 changes: 5 additions & 5 deletions Telepath/TPTrackerKeyboard.m
Expand Up @@ -17,8 +17,8 @@ @interface TPTrackerKeyboard ()
@property NSArray *punctuation;
@property NSMutableString *veryBad;
@property id eventMonitor;
@property uint previousEvents;
@property (readwrite) uint totalEvents;
@property NSInteger previousEvents;
@property (readwrite) NSInteger totalEvents;

@end

Expand All @@ -38,7 +38,7 @@ - (id)init
BOOL accessibilityEnabled = AXIsProcessTrustedWithOptions((__bridge CFDictionaryRef)options);
NSLog(@"Accessibility is enabled? %d", accessibilityEnabled);

uint logMask = (NSKeyDownMask|NSKeyUpMask|NSFlagsChangedMask);
NSInteger logMask = (NSKeyDownMask|NSKeyUpMask|NSFlagsChangedMask);
self.eventMonitor = [NSEvent addGlobalMonitorForEventsMatchingMask:logMask handler:^(NSEvent *e) { [self onInputEvent:e]; }];
self.previousEvents = [[NSUserDefaults standardUserDefaults] integerForKey:@"previousKeyboardEvents"];
self.totalEvents = [[NSUserDefaults standardUserDefaults] integerForKey:@"totalKeyboardEvents"];
Expand All @@ -50,7 +50,7 @@ - (id)init
return self;
}

- (uint)currentEvents {
- (NSInteger)currentEvents {
return self.totalEvents - self.previousEvents;
}

Expand All @@ -66,7 +66,7 @@ - (void)loadReallyBadStuff {
self.reallyBadStuff = [[contents stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]] componentsSeparatedByString:@"\n"];
self.punctuation = @[@" ", @",", @".", @";", @"?", @"!", @"'", @"\"", @"-", @"/", @"(", @")", @"[", @"]", @"\n"];
self.veryBad = [NSMutableString string];
for(uint i = 0; i < [[self.reallyBadStuff lastObject] length]; ++i)
for(NSInteger i = 0; i < [[self.reallyBadStuff lastObject] length]; ++i)
[self.veryBad appendFormat:@"%C", (unichar)([[self.reallyBadStuff lastObject] characterAtIndex:i] - 1)];
}

Expand Down
4 changes: 2 additions & 2 deletions Telepath/TPTrackerMouse.h
Expand Up @@ -9,7 +9,7 @@
#import <Foundation/Foundation.h>

@interface TPTrackerMouse : NSObject
@property (readonly) uint currentEvents;
@property (readonly) uint totalEvents;
@property (readonly) NSInteger currentEvents;
@property (readonly) NSInteger totalEvents;

@end
8 changes: 4 additions & 4 deletions Telepath/TPTrackerMouse.m
Expand Up @@ -14,8 +14,8 @@ @interface TPTrackerMouse ()

@property NSMutableArray *events;
@property id eventMonitor;
@property uint previousEvents;
@property (readwrite) uint totalEvents;
@property NSInteger previousEvents;
@property (readwrite) NSInteger totalEvents;

@end

Expand All @@ -25,7 +25,7 @@ - (id)init
{
self = [super init];
if (self) {
uint logMask = (NSLeftMouseDraggedMask|NSMouseMovedMask|NSLeftMouseDownMask|NSRightMouseDownMask|NSLeftMouseUpMask|NSRightMouseUpMask);
NSInteger logMask = (NSLeftMouseDraggedMask|NSMouseMovedMask|NSLeftMouseDownMask|NSRightMouseDownMask|NSLeftMouseUpMask|NSRightMouseUpMask);
self.eventMonitor = [NSEvent addGlobalMonitorForEventsMatchingMask:logMask handler:^(NSEvent *e) { [self onInputEvent:e]; }];
self.previousEvents = [[NSUserDefaults standardUserDefaults] integerForKey:@"previousMouseEvents"];
self.totalEvents = [[NSUserDefaults standardUserDefaults] integerForKey:@"totalMouseEvents"];
Expand All @@ -37,7 +37,7 @@ - (id)init
return self;
}

- (uint)currentEvents {
- (NSInteger)currentEvents {
return self.totalEvents - self.previousEvents;
}

Expand Down
2 changes: 1 addition & 1 deletion Telepath/TPTrackerScreen.m
Expand Up @@ -24,7 +24,7 @@ - (id)initWithRecordingInterval:(NSTimeInterval)recordingInterval {
if(self) {
self.recordingInterval = recordingInterval; // Starts recording.
[[NSNotificationCenter defaultCenter] addObserverForName:TPActivityWindow object:nil queue:nil usingBlock:^(NSNotification *note) {
self.currentWindowID = [note.userInfo[@"currentWindowID"] integerValue];
self.currentWindowID = (uint)[note.userInfo[@"currentWindowID"] integerValue];
CGRect bounds;
CGRectMakeWithDictionaryRepresentation((__bridge CFDictionaryRef)note.userInfo[@"currentWindowBounds"], &bounds);
self.currentWindowRect = bounds;
Expand Down
6 changes: 3 additions & 3 deletions Telepath/TPTrackerTrello.h
Expand Up @@ -27,8 +27,8 @@
#import <Foundation/Foundation.h>

@interface TPTrackerTrello : NSObject
@property (readonly) uint currentTrellosSlain;
@property (readonly) uint totalTrellosSlain;
@property (readonly) uint trellosAlive;
@property (readonly) NSInteger currentTrellosSlain;
@property (readonly) NSInteger totalTrellosSlain;
@property (readonly) NSInteger trellosAlive;

@end
12 changes: 6 additions & 6 deletions Telepath/TPTrackerTrello.m
Expand Up @@ -18,9 +18,9 @@ @interface TPTrackerTrello ()
@property NSString *trelloApplicationKey;
@property NSString *trelloApplicationSecret;
@property NSString *trelloToken;
@property uint previousTrellosSlain;
@property (readwrite) uint totalTrellosSlain;
@property (readwrite) uint trellosAlive;
@property NSInteger previousTrellosSlain;
@property (readwrite) NSInteger totalTrellosSlain;
@property (readwrite) NSInteger trellosAlive;

@end

Expand Down Expand Up @@ -61,7 +61,7 @@ - (void)dealloc
[[NSNotificationCenter defaultCenter] removeObserver:self];
}

- (uint)currentTrellosSlain {
- (NSInteger)currentTrellosSlain {
return self.totalTrellosSlain - self.previousTrellosSlain;
}

Expand All @@ -74,8 +74,8 @@ - (void)pollTrello:(NSTimer *)t {
NSArray *cards = arrayFromJSON(data);
if(![cards count]) return;
//NSLog(@"Got %lu cards: %@", [cards count], cards);
uint newTrellosAlive = 0;
uint newTrellosSlain = 0;
NSInteger newTrellosAlive = 0;
NSInteger newTrellosSlain = 0;
for(NSDictionary *card in cards) {
if(![self.trelloBoards containsObject:card[@"idBoard"]]) continue;
BOOL done = [self.trelloDoneLists containsObject:card[@"idList"]];
Expand Down
4 changes: 2 additions & 2 deletions Telepath/TPTrackerWindow.h
Expand Up @@ -9,7 +9,7 @@
#import <Foundation/Foundation.h>

@interface TPTrackerWindow : NSObject
@property (readonly) uint currentEvents;
@property (readonly) uint totalEvents;
@property (readonly) NSInteger currentEvents;
@property (readonly) NSInteger totalEvents;

@end
6 changes: 3 additions & 3 deletions Telepath/TPTrackerWindow.m
Expand Up @@ -17,8 +17,8 @@ @interface TPTrackerWindow ()
@property NSString *lastURL;
@property NSTimeInterval lastWindowSwitch;
@property NSTimer *windowSampleTimer;
@property uint previousEvents;
@property (readwrite) uint totalEvents;
@property NSInteger previousEvents;
@property (readwrite) NSInteger totalEvents;

@end

Expand All @@ -43,7 +43,7 @@ - (id)init
return self;
}

- (uint)currentEvents {
- (NSInteger)currentEvents {
return self.totalEvents - self.previousEvents;
}

Expand Down
4 changes: 3 additions & 1 deletion Telepath/TPWindow.m
Expand Up @@ -27,6 +27,8 @@ - (BOOL)canBecomeMainWindow {
return YES;
}


- (BOOL)isMovableByWindowBackground {
return YES;
}

@end

0 comments on commit 7456a51

Please sign in to comment.