Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
Dashboard view works. It still needs some love
Browse files Browse the repository at this point in the history
  • Loading branch information
kyleconroy committed Mar 4, 2012
1 parent fb94de2 commit a25aea9
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 31 deletions.
12 changes: 8 additions & 4 deletions osx/timesuck.xcodeproj/project.pbxproj
Expand Up @@ -36,14 +36,17 @@
9566DCED140B73810030399A /* clock.icns in Resources */ = {isa = PBXBuildFile; fileRef = 9566DCEC140B73810030399A /* clock.icns */; };
9577B7AB14B84D3C0012936D /* MyHTTPConnection.m in Sources */ = {isa = PBXBuildFile; fileRef = 9577B7AA14B84D3C0012936D /* MyHTTPConnection.m */; };
95B2579215035F9300E039F2 /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 95B2579115035F9300E039F2 /* WebKit.framework */; };
95B2579D1503618600E039F2 /* .graph.html.swp in Resources */ = {isa = PBXBuildFile; fileRef = 95B257951503618600E039F2 /* .graph.html.swp */; };
95B2579E1503618600E039F2 /* d3.min.js in Sources */ = {isa = PBXBuildFile; fileRef = 95B257961503618600E039F2 /* d3.min.js */; };
95B2579F1503618600E039F2 /* graph.html in Resources */ = {isa = PBXBuildFile; fileRef = 95B257971503618600E039F2 /* graph.html */; };
95B257A01503618600E039F2 /* graph.js in Sources */ = {isa = PBXBuildFile; fileRef = 95B257981503618600E039F2 /* graph.js */; };
95B257A11503618600E039F2 /* jquery-1.7.1.min.js in Sources */ = {isa = PBXBuildFile; fileRef = 95B257991503618600E039F2 /* jquery-1.7.1.min.js */; };
95B257A21503618600E039F2 /* rickshaw.min.css in Resources */ = {isa = PBXBuildFile; fileRef = 95B2579A1503618600E039F2 /* rickshaw.min.css */; };
95B257A31503618600E039F2 /* rickshaw.min.js in Sources */ = {isa = PBXBuildFile; fileRef = 95B2579B1503618600E039F2 /* rickshaw.min.js */; };
95B257A41503618600E039F2 /* style.css in Resources */ = {isa = PBXBuildFile; fileRef = 95B2579C1503618600E039F2 /* style.css */; };
95B257A515036C2A00E039F2 /* d3.min.js in Resources */ = {isa = PBXBuildFile; fileRef = 95B257961503618600E039F2 /* d3.min.js */; };
95B257A615036C2A00E039F2 /* graph.js in Resources */ = {isa = PBXBuildFile; fileRef = 95B257981503618600E039F2 /* graph.js */; };
95B257A715036C2A00E039F2 /* jquery-1.7.1.min.js in Resources */ = {isa = PBXBuildFile; fileRef = 95B257991503618600E039F2 /* jquery-1.7.1.min.js */; };
95B257A815036C2A00E039F2 /* rickshaw.min.js in Resources */ = {isa = PBXBuildFile; fileRef = 95B2579B1503618600E039F2 /* rickshaw.min.js */; };
95BDD6B3140B32FD00BF6B6B /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 95BDD6B2140B32FD00BF6B6B /* Cocoa.framework */; };
95BDD6BD140B32FD00BF6B6B /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 95BDD6BB140B32FD00BF6B6B /* InfoPlist.strings */; };
95BDD6C0140B32FD00BF6B6B /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 95BDD6BF140B32FD00BF6B6B /* main.m */; };
Expand Down Expand Up @@ -122,7 +125,6 @@
9577B7A914B84D3C0012936D /* MyHTTPConnection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MyHTTPConnection.h; sourceTree = "<group>"; };
9577B7AA14B84D3C0012936D /* MyHTTPConnection.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MyHTTPConnection.m; sourceTree = "<group>"; };
95B2579115035F9300E039F2 /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = System/Library/Frameworks/WebKit.framework; sourceTree = SDKROOT; };
95B257951503618600E039F2 /* .graph.html.swp */ = {isa = PBXFileReference; lastKnownFileType = file; path = .graph.html.swp; sourceTree = "<group>"; };
95B257961503618600E039F2 /* d3.min.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = d3.min.js; sourceTree = "<group>"; };
95B257971503618600E039F2 /* graph.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = graph.html; sourceTree = "<group>"; };
95B257981503618600E039F2 /* graph.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = graph.js; sourceTree = "<group>"; };
Expand Down Expand Up @@ -274,7 +276,6 @@
95B257941503618600E039F2 /* web */ = {
isa = PBXGroup;
children = (
95B257951503618600E039F2 /* .graph.html.swp */,
95B257961503618600E039F2 /* d3.min.js */,
95B257971503618600E039F2 /* graph.html */,
95B257981503618600E039F2 /* graph.js */,
Expand Down Expand Up @@ -449,13 +450,16 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
95B257A515036C2A00E039F2 /* d3.min.js in Resources */,
95B257A615036C2A00E039F2 /* graph.js in Resources */,
95B257A715036C2A00E039F2 /* jquery-1.7.1.min.js in Resources */,
95B257A815036C2A00E039F2 /* rickshaw.min.js in Resources */,
95BDD6BD140B32FD00BF6B6B /* InfoPlist.strings in Resources */,
95BDD6C3140B32FE00BF6B6B /* Credits.rtf in Resources */,
95BDD6C9140B32FE00BF6B6B /* MainMenu.xib in Resources */,
9566DCED140B73810030399A /* clock.icns in Resources */,
9520BF7414B84A81000FFB06 /* About.txt in Resources */,
9520BF8314B84A81000FFB06 /* About.txt in Resources */,
95B2579D1503618600E039F2 /* .graph.html.swp in Resources */,
95B2579F1503618600E039F2 /* graph.html in Resources */,
95B257A21503618600E039F2 /* rickshaw.min.css in Resources */,
95B257A41503618600E039F2 /* style.css in Resources */,
Expand Down
76 changes: 59 additions & 17 deletions osx/timesuck/en.lproj/MainMenu.xib
Expand Up @@ -1283,6 +1283,24 @@
<reference key="NSOnImage" ref="35465992"/>
<reference key="NSMixedImage" ref="502551668"/>
</object>
<object class="NSMenuItem" id="599560847">
<reference key="NSMenu" ref="835318025"/>
<string key="NSTitle">Dashboard</string>
<string key="NSKeyEquiv"/>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="35465992"/>
<reference key="NSMixedImage" ref="502551668"/>
</object>
<object class="NSMenuItem" id="950871480">
<reference key="NSMenu" ref="835318025"/>
<bool key="NSIsDisabled">YES</bool>
<bool key="NSIsSeparator">YES</bool>
<string key="NSTitle"/>
<string key="NSKeyEquiv"/>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="35465992"/>
<reference key="NSMixedImage" ref="502551668"/>
</object>
<object class="NSMenuItem" id="625202149">
<reference key="NSMenu" ref="835318025"/>
<string key="NSTitle">Bring All to Front</string>
Expand Down Expand Up @@ -1330,22 +1348,22 @@
<object class="NSCustomObject" id="755631768">
<string key="NSClassName">NSFontManager</string>
</object>
<object class="NSWindowTemplate" id="935045540">
<object class="NSWindowTemplate" id="324008565">
<int key="NSWindowStyleMask">15</int>
<int key="NSWindowBacking">2</int>
<string key="NSWindowRect">{{251, 106}, {800, 600}}</string>
<int key="NSWTFlags">611845120</int>
<int key="NSWTFlags">1685586944</int>
<string key="NSWindowTitle">Timesuck Dashboard</string>
<string key="NSWindowClass">NSWindow</string>
<nil key="NSViewClass"/>
<nil key="NSUserInterfaceItemIdentifier"/>
<object class="NSView" key="NSWindowView" id="799070189">
<object class="NSView" key="NSWindowView" id="138075249">
<reference key="NSNextResponder"/>
<int key="NSvFlags">256</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="WebView" id="876756449">
<reference key="NSNextResponder" ref="799070189"/>
<object class="WebView" id="935487624">
<reference key="NSNextResponder" ref="138075249"/>
<int key="NSvFlags">274</int>
<object class="NSMutableSet" key="NSDragTypes">
<bool key="EncodedWithXMLCoder">YES</bool>
Expand All @@ -1369,7 +1387,7 @@
</object>
</object>
<string key="NSFrameSize">{800, 600}</string>
<reference key="NSSuperview" ref="799070189"/>
<reference key="NSSuperview" ref="138075249"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView"/>
<string key="NSReuseIdentifierKey">_NS:51</string>
Expand Down Expand Up @@ -1404,7 +1422,7 @@
<string key="NSFrameSize">{800, 600}</string>
<reference key="NSSuperview"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="876756449"/>
<reference key="NSNextKeyView" ref="935487624"/>
<string key="NSReuseIdentifierKey">_NS:224</string>
</object>
<string key="NSScreenRect">{{0, 0}, {1280, 778}}</string>
Expand Down Expand Up @@ -2091,18 +2109,26 @@
<object class="IBOutletConnection" key="connection">
<string key="label">window</string>
<reference key="source" ref="976324537"/>
<reference key="destination" ref="935045540"/>
<reference key="destination" ref="324008565"/>
</object>
<int key="connectionID">542</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">webView</string>
<reference key="source" ref="976324537"/>
<reference key="destination" ref="876756449"/>
<reference key="destination" ref="935487624"/>
</object>
<int key="connectionID">544</int>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">showWindow</string>
<reference key="source" ref="976324537"/>
<reference key="destination" ref="599560847"/>
</object>
<int key="connectionID">549</int>
</object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
Expand Down Expand Up @@ -2521,6 +2547,8 @@
<reference ref="625202149"/>
<reference ref="575023229"/>
<reference ref="1011231497"/>
<reference ref="599560847"/>
<reference ref="950871480"/>
</object>
<reference key="parent" ref="713487014"/>
</object>
Expand Down Expand Up @@ -3134,26 +3162,36 @@
</object>
<object class="IBObjectRecord">
<int key="objectID">537</int>
<reference key="object" ref="935045540"/>
<reference key="object" ref="324008565"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="799070189"/>
<reference ref="138075249"/>
</object>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">538</int>
<reference key="object" ref="799070189"/>
<reference key="object" ref="138075249"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="876756449"/>
<reference ref="935487624"/>
</object>
<reference key="parent" ref="935045540"/>
<reference key="parent" ref="324008565"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">541</int>
<reference key="object" ref="876756449"/>
<reference key="parent" ref="799070189"/>
<reference key="object" ref="935487624"/>
<reference key="parent" ref="138075249"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">545</int>
<reference key="object" ref="599560847"/>
<reference key="parent" ref="835318025"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">546</int>
<reference key="object" ref="950871480"/>
<reference key="parent" ref="835318025"/>
</object>
</object>
</object>
Expand Down Expand Up @@ -3300,6 +3338,8 @@
<string>537.NSWindowTemplate.visibleAtLaunch</string>
<string>538.IBPluginDependency</string>
<string>541.IBPluginDependency</string>
<string>545.IBPluginDependency</string>
<string>546.IBPluginDependency</string>
<string>56.IBPluginDependency</string>
<string>57.IBPluginDependency</string>
<string>58.IBPluginDependency</string>
Expand Down Expand Up @@ -3472,6 +3512,8 @@
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
</object>
</object>
<object class="NSMutableDictionary" key="unlocalizedProperties">
Expand All @@ -3486,7 +3528,7 @@
<reference key="dict.values" ref="0"/>
</object>
<nil key="sourceID"/>
<int key="maxID">544</int>
<int key="maxID">549</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
Expand Down
1 change: 1 addition & 0 deletions osx/timesuck/timesuckAppDelegate.h
Expand Up @@ -34,6 +34,7 @@
@property (nonatomic, retain, readonly) NSManagedObjectModel *managedObjectModel;
@property (nonatomic, retain, readonly) NSManagedObjectContext *managedObjectContext;

- (IBAction)showWindow:sender;
- (IBAction)saveAction:sender;
- (FMDatabase*)initDatabase;
- (void)logForType:(NSString*)type name:(NSString*)name start:(NSDate *)start end:(NSDate *)end;
Expand Down
25 changes: 15 additions & 10 deletions osx/timesuck/timesuckAppDelegate.m
Expand Up @@ -19,6 +19,9 @@ @implementation timesuckAppDelegate

- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
[[NSUserDefaults standardUserDefaults] setBool:TRUE forKey:@"WebKitDeveloperExtras"];
[[NSUserDefaults standardUserDefaults] synchronize];

// Set last wake to now
lastWake = [[NSDate alloc] init];

Expand All @@ -28,15 +31,6 @@ - (void)applicationDidFinishLaunching:(NSNotification *)aNotification
return;
}

//Setup the webview?
NSString* filePath = [[NSBundle mainBundle] pathForResource:@"graph"
ofType:@"html"
inDirectory:@"web"];
NSLog(@"%@", filePath);
NSURL* fileURL = [NSURL fileURLWithPath:filePath];
NSURLRequest* request = [NSURLRequest requestWithURL:fileURL];
[[webView mainFrame] loadRequest:request];

// Not sure if this is needed
[db retain];

Expand Down Expand Up @@ -85,6 +79,13 @@ - (void)applicationDidFinishLaunching:(NSNotification *)aNotification
name:NSWorkspaceDidActivateApplicationNotification object:nil];
[notCenter addObserver:self selector:@selector(applicationDidDeactivate:)
name:NSWorkspaceDidDeactivateApplicationNotification object:nil];

//Setup the webview?
NSString* filePath = [[NSBundle mainBundle] pathForResource:@"graph"
ofType:@"html"];
NSURL* fileURL = [NSURL fileURLWithPath:filePath];
NSURLRequest* request = [NSURLRequest requestWithURL:fileURL];
[[webView mainFrame] loadRequest:request];
}

- (NSDate *)parseDate:(NSString *)dateStr
Expand Down Expand Up @@ -139,7 +140,7 @@ - (NSString*)graphJson
while ([s next]) {
NSMutableDictionary *point = [[NSMutableDictionary alloc] init];
[point setObject:[NSNumber numberWithDouble:[s doubleForColumnIndex:0]] forKey:@"x"];
[point setObject:[NSNumber numberWithDouble:[s doubleForColumnIndex:1]] forKey:@"y"];
[point setObject:[NSNumber numberWithDouble:[s doubleForColumnIndex:1] / 3600] forKey:@"y"];
[data addObject:point];
}

Expand Down Expand Up @@ -182,6 +183,10 @@ - (void)deactivateApplication:(NSString *)localizedName
[applications removeObjectForKey:localizedName];
}

-(IBAction)showWindow:(id)sender{
[window makeKeyAndOrderFront:nil];
}

- (void)applicationDidDeactivate:(NSNotification *)notification
{
NSRunningApplication *app = [[notification userInfo] objectForKey:@"NSWorkspaceApplicationKey"];
Expand Down

0 comments on commit a25aea9

Please sign in to comment.