Skip to content

Commit b39f3ce

Browse files
committed
First git commit
0 parents  commit b39f3ce

File tree

126 files changed

+34543
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

126 files changed

+34543
-0
lines changed

.gitignore

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Finder and Xcode ignored files
2+
.DS_Store
3+
xcuserdata/
4+
5+
# Other
6+
/App Store/
+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
//
2+
// GPSRecorderAppDelegate.h
3+
// GPS Stone Trip Recorder
4+
//
5+
// Created by François on 7/10/09.
6+
// Copyright VSO-Software 2009. All rights reserved.
7+
//
8+
9+
#import "GPXgpxType.h"
10+
11+
@class MainViewController;
12+
13+
@interface GPSStoneTripRecorderAppDelegate : NSObject <UIApplicationDelegate> {
14+
UIWindow *window;
15+
MainViewController *mainViewController;
16+
17+
GPXgpxType *gpxElement;
18+
}
19+
@property (nonatomic, retain) IBOutlet UIWindow *window;
20+
@property (nonatomic, retain) MainViewController *mainViewController;
21+
22+
@end
+86
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
//
2+
// GPSRecorderAppDelegate.m
3+
// GPS Stone Trip Recorder
4+
//
5+
// Created by François on 7/10/09.
6+
// Copyright VSO-Software 2009. All rights reserved.
7+
//
8+
9+
#import <MapKit/MKTypes.h>
10+
11+
#import "GPSStoneTripRecorderAppDelegate.h"
12+
#import "MainViewController.h"
13+
14+
#import "VSOUtils.h"
15+
16+
@implementation GPSStoneTripRecorderAppDelegate
17+
18+
@synthesize window;
19+
@synthesize mainViewController;
20+
21+
+ (void)initialize
22+
{
23+
NSMutableDictionary *defaultValues = [NSMutableDictionary dictionary];
24+
25+
[defaultValues setValue:[NSNumber numberWithBool:YES] forKey:VSO_UDK_FIRST_RUN];
26+
[defaultValues setValue:[NSNumber numberWithBool:YES] forKey:VSO_UDK_FIRST_UNLOCK];
27+
[defaultValues setValue:[NSNumber numberWithInt:0] forKey:VSO_UDK_SELECTED_PAGE];
28+
[defaultValues setValue:[NSNumber numberWithInt:MKMapTypeStandard] forKey:VSO_UDK_MAP_TYPE];
29+
[defaultValues setValue:[NSNumber numberWithInt:25] forKey:VSO_UDK_MIN_PATH_DISTANCE];
30+
[defaultValues setValue:[NSNumber numberWithBool:YES] forKey:VSO_UDK_PAUSE_ON_QUIT];
31+
[defaultValues setValue:[NSNumber numberWithBool:YES] forKey:VSO_UDK_SKIP_NON_ACCURATE_POINTS];
32+
[defaultValues setValue:[NSNumber numberWithBool:NO] forKey:VSO_UDK_MAP_SWIPE_WARNING_SHOWN];
33+
[defaultValues setValue:[NSNumber numberWithBool:YES] forKey:VSO_UDK_SHOW_MEMORY_CLEAR_WARNING];
34+
[defaultValues setValue:[NSNumber numberWithBool:NO] forKey:VSO_UDK_MEMORY_WARNING_PATH_CUT_SHOWN];
35+
[defaultValues setValue:[NSNumber numberWithDouble:2] forKey:VSO_UDK_MIN_TIME_FOR_UPDATE];
36+
[defaultValues setValue:[NSNumber numberWithDouble:3*60] forKey:VSO_UDK_TURN_OFF_SCREEN_DELAY];
37+
[defaultValues setValue:@"" forKey:VSO_UDK_USER_EMAIL];
38+
if ([[[NSLocale currentLocale] objectForKey:NSLocaleUsesMetricSystem] boolValue]) [defaultValues setValue:[NSNumber numberWithUnsignedInt:VSODistanceUnitKilometers] forKey:VSO_UDK_DISTANCE_UNIT];
39+
else [defaultValues setValue:[NSNumber numberWithUnsignedInt:VSODistanceUnitMiles] forKey:VSO_UDK_DISTANCE_UNIT];
40+
41+
[[NSUserDefaults standardUserDefaults] registerDefaults:defaultValues];
42+
}
43+
44+
- (void)alertView:(UIAlertView *)alertView willDismissWithButtonIndex:(NSInteger)buttonIndex
45+
{
46+
exit(1);
47+
}
48+
49+
- (void)applicationDidFinishLaunching:(UIApplication *)application
50+
{
51+
NSFileManager *fm = [NSFileManager defaultManager];
52+
/* Creating data dir */
53+
if (![fm createDirectoryAtPath:VSO_PATH_TO_FOLDER_WITH_GPX_FILES withIntermediateDirectories:YES attributes:nil error:NULL]) {
54+
[[[[UIAlertView alloc] initWithTitle:NSLocalizedString(@"internal error", nil) message:[NSString stringWithFormat:NSLocalizedString(@"please contact developer error code #", nil), 1] delegate:self cancelButtonTitle:nil otherButtonTitles:NSLocalizedString(@"ok", nil), nil] autorelease] show];
55+
return;
56+
}
57+
58+
MainViewController *aController = [[MainViewController alloc] initWithNibName:@"MainView" bundle:nil];
59+
self.mainViewController = aController;
60+
[aController release];
61+
62+
[[UIApplication sharedApplication] setStatusBarStyle:VSO_APPLICATION_STATUS_BAR_STYLE animated:NO];
63+
mainViewController.view.frame = [UIScreen mainScreen].applicationFrame;
64+
[window addSubview:[mainViewController view]];
65+
[window makeKeyAndVisible];
66+
67+
if ([fm fileExistsAtPath:VSO_PATH_TO_NICE_EXIT_WITNESS]) {
68+
NSLog(@"Last exit was forced");
69+
[self.mainViewController recoverFromCrash];
70+
}
71+
[[NSData data] writeToFile:VSO_PATH_TO_NICE_EXIT_WITNESS atomically:NO];
72+
}
73+
74+
- (void)applicationWillTerminate:(UIApplication *)application
75+
{
76+
[mainViewController saveRecordingListStoppingGPX:YES];
77+
[[NSFileManager defaultManager] removeItemAtPath:VSO_PATH_TO_NICE_EXIT_WITNESS error:NULL];
78+
}
79+
80+
- (void)dealloc {
81+
[mainViewController release];
82+
[window release];
83+
[super dealloc];
84+
}
85+
86+
@end

Classes/MainView.h

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
//
2+
// MainView.h
3+
// GPS Stone Trip Recorder
4+
//
5+
// Created by François on 7/10/09.
6+
// Copyright VSO-Software 2009. All rights reserved.
7+
//
8+
9+
#import <UIKit/UIKit.h>
10+
11+
@interface MainView : UIView {
12+
}
13+
14+
@end

Classes/MainView.m

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
//
2+
// MainView.m
3+
// GPS Stone Trip Recorder
4+
//
5+
// Created by François on 7/10/09.
6+
// Copyright VSO-Software 2009. All rights reserved.
7+
//
8+
9+
#import "MainView.h"
10+
11+
#import "Constants.h"
12+
13+
@implementation MainView
14+
15+
- (id)initWithFrame:(CGRect)frame {
16+
if (self = [super initWithFrame:frame]) {
17+
}
18+
return self;
19+
}
20+
21+
22+
- (void)drawRect:(CGRect)rect {
23+
}
24+
25+
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event
26+
{
27+
[[NSNotificationCenter defaultCenter] postNotification:[NSNotification notificationWithName:VSO_NTF_VIEW_TOUCHED object:self]];
28+
return [super hitTest:point withEvent:event];
29+
}
30+
31+
32+
- (void)dealloc {
33+
[super dealloc];
34+
}
35+
36+
@end

Classes/MainViewController.h

+86
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
//
2+
// MainViewController.h
3+
// GPS Stone Trip Recorder
4+
//
5+
// Created by François on 7/10/09.
6+
// Copyright VSO-Software 2009. All rights reserved.
7+
//
8+
9+
#import "VSOSettingsViewController.h"
10+
#import "VSORecordingsListViewCtlr.h"
11+
12+
#import "VSODetailsViewCtrl.h"
13+
#import "VSOMapViewController.h"
14+
#import "VSOInfoViewCtrl.h"
15+
#import "VSOScrollView.h"
16+
#import "VSOBlankView.h"
17+
18+
#import "GPXgpxType.h"
19+
#import "Constants.h"
20+
21+
/* Note: The code to manage the pages is found in the sample codes of Apple (sample named PageControl) */
22+
23+
#define SIMULATOR_CODE
24+
#undef SIMULATOR_CODE
25+
26+
@interface MainViewController : UIViewController <VSOSettingsViewControllerDelegate, VSORecordingsListViewControllerDelegate, UIScrollViewDelegate, CLLocationManagerDelegate, VSOInfoGenericControllerDelegate> {
27+
IBOutlet VSOScrollView *pagesView;
28+
IBOutlet UIPageControl *pageControl;
29+
30+
IBOutlet UIButton *buttonRecord;
31+
IBOutlet UIButton *buttonInfoDark;
32+
IBOutlet UIButton *buttonInfoLight;
33+
IBOutlet UIButton *buttonListOfRecordings;
34+
35+
IBOutlet UIView *viewMiniInfos;
36+
IBOutlet UILabel *labelMiniInfosDistance;
37+
IBOutlet UILabel *labelMiniInfosRecordTime;
38+
IBOutlet UILabel *labelMiniInfosRecordingState;
39+
40+
/* To manage the pages */
41+
int selPage;
42+
BOOL pageControlUsed;
43+
NSArray *ctrlClassesForPages;
44+
NSMutableArray *viewControllers;
45+
NSMutableArray *viewControllersStates;
46+
NSTimer *timerToUnloadUnusedPages;
47+
48+
NSTimer *timerToTurnOffScreen;
49+
VSOBlankView *viewBlankScreen;
50+
int selPageBeforeShuttingScreenOff;
51+
52+
NSMutableArray *recordingList;
53+
54+
GPXgpxType *currentGpx;
55+
GPXtrksegType *currentTracksegment;
56+
NSString *currentGpxOutputPath;
57+
NSFileHandle *currentGpxOutput;
58+
59+
VSORecordState recordState;
60+
NSDate *dateRecordStart;
61+
NSMutableDictionary *currentRecordingInfo;
62+
63+
CLLocationManager *locationManager;
64+
CLLocation *currentLocation;
65+
NSTimer *timerToRefreshTimes;
66+
67+
BOOL alertIsForStop;
68+
69+
#ifdef SIMULATOR_CODE
70+
NSTimer *t;
71+
CLLocationCoordinate2D coordinate;
72+
#endif
73+
}
74+
@property(nonatomic, assign) int selPage;
75+
- (IBAction)showInfo;
76+
- (IBAction)changePage:(id)sender;
77+
78+
- (IBAction)recordPauseButtonAction:(id)sender;
79+
- (IBAction)showRecordsListStopRecordButtonAction:(id)sender;
80+
81+
- (void)setLocationServicesEnable:(BOOL)enabled;
82+
83+
- (void)saveRecordingListStoppingGPX:(BOOL)saveGPX;
84+
- (void)recoverFromCrash;
85+
86+
@end

0 commit comments

Comments
 (0)