This repository has been archived by the owner on Oct 23, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Boot2EFIAppDelegate.m
117 lines (101 loc) · 4.05 KB
/
Boot2EFIAppDelegate.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
//
// Boot2EFIAppDelegate.m
// Boot2EFI
//
// Created by Eduard Sionov on 1/16/11.
// Copyright 2011 __MyCompanyName__. All rights reserved.
//
#import "Boot2EFIAppDelegate.h"
#import "EFIDiskUtil.h"
#import "EFIViewController.h"
@implementation Boot2EFIAppDelegate
@synthesize window;
@synthesize efiViewController;
@synthesize installationViewController;
@synthesize efiInstaller;
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
// Insert code here to initialize your application
[[window contentView] addSubview:efiViewController.view positioned:0 relativeTo:nil];
}
#pragma -
#pragma EFIViewControllerDelegate Method
-(void)parametersSelectionComplete {
NSOperationQueue *installationProccessQueue = [[NSOperationQueue alloc] init];
[installationProccessQueue addOperationWithBlock:^{
//create EFIInstaller object for full instalation
efiInstaller = [[EFIInstaller alloc] initWithInstallInfo:efiViewController.installInfo];
efiInstaller.delegate = self;
[efiInstaller install];
}];
}
#pragma -
#pragma EFIInstallerDelegate Method
-(void)userDidAuthorized {
NSArray *subviews = [[window contentView] subviews];
[[subviews objectAtIndex:1] removeFromSuperview];
[[subviews objectAtIndex:0] removeFromSuperview];
//[[subviews objectAtIndex:1] removeFromSuperview];
/*for (id subview in subviews) {
[subview removeFromSuperview];
}*/
[[window contentView] addSubview:installationViewController.view positioned:0 relativeTo:nil];
}
-(void)installerDidFinished {
[window orderOut:nil];
NSRunAlertPanel(@"Installation complete!", [NSString stringWithFormat:@"Be happy!"], nil, nil, nil);
[[NSApplication sharedApplication] terminate:self];
}
-(void)installerDidStarted {
[installationViewController.progressIndicator setDoubleValue:0.0];
}
-(void)mountHFSErrorWasRemoved {
[installationViewController.statusLabel setStringValue:@"Removing mount_hfs error"];
}
-(void)EFIPartitionReformated {
[installationViewController.statusLabel setStringValue:@"Formating EFI partition"];
[installationViewController.progressIndicator setDoubleValue:10.0];
}
-(void)EFIPartitionMounted {
[installationViewController.statusLabel setStringValue:@"Mounting EFI partition"];
[installationViewController.progressIndicator setDoubleValue:20.0];
}
-(void)fileStructureWasCreated {
[installationViewController.statusLabel setStringValue:@"Creating file structure"];
[installationViewController.progressIndicator setDoubleValue:30.0];
}
-(void)bootloaderBeganInstallation {
[installationViewController.statusLabel setStringValue:@"Installing bootloader"];
[installationViewController.progressIndicator setDoubleValue:40.0];
}
-(void)bootFileCopied {
[installationViewController.statusLabel setStringValue:@"Copying boot file"];
[installationViewController.progressIndicator setDoubleValue:50.0];
}
-(void)kextsCopied {
[installationViewController.statusLabel setStringValue:@"Copying extensions"];
[installationViewController.progressIndicator setDoubleValue:60.0];
}
-(void)extraPathCopied {
[installationViewController.statusLabel setStringValue:@"Copying Extra folder"];
[installationViewController.progressIndicator setDoubleValue:70.0];
}
-(void)DSDTCopied {
[installationViewController.statusLabel setStringValue:@"Copying DSDT"];
[installationViewController.progressIndicator setDoubleValue:80.0];
}
-(void) EFIPartitionUnmountedAndMountDirectoryDeleted {
[installationViewController.statusLabel setStringValue:@"Unmounting EFI partition"];
[installationViewController.progressIndicator setDoubleValue:90.0];
}
-(void) partitionMadeBootable {
[installationViewController.statusLabel setStringValue:@"Making partition bootable"];
[installationViewController.progressIndicator setDoubleValue:100.0];
}
-(IBAction)donate:(id)sender {
[[NSWorkspace sharedWorkspace] openURL: [NSURL URLWithString: @"http://trigen.pro/donate"]];
}
- (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)sender
{
return YES;
}
@end