Skip to content

Commit d2c7cfc

Browse files
committed
merge to master
2 parents cdd011d + cad9281 commit d2c7cfc

File tree

238 files changed

+31075
-4657
lines changed

Some content is hidden

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

238 files changed

+31075
-4657
lines changed

.gitignore

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
build
22
build/revision
3-
*.xcodeproj/*.pbxuser
4-
*.xcodeproj/*.perspectivev3
5-
*.xcodeproj/*.mode1v3
6-
*.xcodeproj/*.tm_build_errors
7-
*.tmproj
3+
*.xcodeproj/
4+
!*.xcodeproj/project.pbxproj
85
Nightly.app.zip

ApplicationController.h

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,33 +9,18 @@
99
#import <Cocoa/Cocoa.h>
1010
#import "PBGitRepository.h"
1111

12-
@class PBCLIProxy;
1312
@class PBCloneRepositoryPanel;
1413

15-
@interface ApplicationController : NSObject <NSWindowDelegate>
14+
@interface ApplicationController : NSObject
1615
{
1716
IBOutlet NSWindow *window;
1817
IBOutlet id firstResponder;
1918
NSPersistentStoreCoordinator *persistentStoreCoordinator;
2019
NSManagedObjectModel *managedObjectModel;
2120
NSManagedObjectContext *managedObjectContext;
2221

23-
PBCLIProxy *cliProxy;
24-
NSString * cliArgs;
25-
26-
// CLI set state
27-
BOOL launchedFromGitx;
28-
NSString * deferredSelectSha;
29-
NSArray * launchedDocuments;
30-
3122
PBCloneRepositoryPanel *cloneRepositoryPanel;
3223
}
33-
@property (retain) PBCLIProxy* cliProxy;
34-
@property (copy) NSString *cliArgs;
35-
@property (assign) BOOL launchedFromGitx;
36-
@property (copy) NSString *deferredSelectSha;
37-
38-
+ (ApplicationController *) sharedApplicationController;
3924

4025
- (NSPersistentStoreCoordinator *)persistentStoreCoordinator;
4126
- (NSManagedObjectModel *)managedObjectModel;

ApplicationController.m

Lines changed: 28 additions & 158 deletions
Original file line numberDiff line numberDiff line change
@@ -10,82 +10,36 @@
1010
#import "PBGitRevisionCell.h"
1111
#import "PBGitWindowController.h"
1212
#import "PBRepositoryDocumentController.h"
13-
#import "PBCLIProxy.h"
1413
#import "PBServicesController.h"
1514
#import "PBGitXProtocol.h"
1615
#import "PBPrefsWindowController.h"
1716
#import "PBNSURLPathUserDefaultsTransfomer.h"
1817
#import "PBGitDefaults.h"
19-
#import "Sparkle/SUUpdater.h"
2018
#import "PBCloneRepositoryPanel.h"
21-
#import "BMScript.h"
22-
#import "PBGitSidebarController.h"
19+
#import "Sparkle/SUUpdater.h"
2320

2421
@implementation ApplicationController
25-
@synthesize cliProxy;
26-
@synthesize cliArgs;
27-
@synthesize launchedFromGitx;
28-
@synthesize deferredSelectSha;
29-
30-
static ApplicationController * sharedApplicationControllerInstance = nil;
31-
32-
+ (void) initialize {
33-
if (sharedApplicationControllerInstance == nil)
34-
sharedApplicationControllerInstance = [[self alloc] init];
35-
}
36-
37-
+ (ApplicationController *) sharedApplicationController {
38-
//Already set by +initialize.
39-
return sharedApplicationControllerInstance;
40-
}
41-
42-
+ (id) allocWithZone:(NSZone *) zone {
43-
//Usually already set by +initialize.
44-
if (sharedApplicationControllerInstance) {
45-
//The caller expects to receive a new object, so implicitly retain it
46-
//to balance out the eventual release message.
47-
return [sharedApplicationControllerInstance retain];
48-
} else {
49-
//When not already set, +initialize is our caller.
50-
//It's creating the shared instance, let this go through.
51-
return [super allocWithZone: zone];
52-
}
53-
}
54-
55-
- (id) copyWithZone:(NSZone *) zone {
56-
return self;
57-
}
58-
59-
- (NSUInteger) retainCount {
60-
return UINT_MAX; // denotes an object that cannot be released
61-
}
6222

63-
- (ApplicationController *) init
23+
- (ApplicationController*)init
6424
{
65-
//If sharedApplicationControllerInstance is nil, +initialize is our caller, so initialize the instance.
66-
//If it is not nil, simply return the instance without re-initializing it.
67-
if (sharedApplicationControllerInstance == nil) {
6825
#ifdef DEBUG_BUILD
69-
[NSApp activateIgnoringOtherApps:YES];
26+
[NSApp activateIgnoringOtherApps:YES];
7027
#endif
71-
if(self = [super init]) {
72-
if(![[NSBundle bundleWithPath:@"/System/Library/Frameworks/Quartz.framework/Frameworks/QuickLookUI.framework"] load])
73-
if(![[NSBundle bundleWithPath:@"/System/Library/PrivateFrameworks/QuickLookUI.framework"] load])
74-
NSLog(@"Could not load QuickLook");
75-
76-
self.cliProxy = [PBCLIProxy new];
77-
launchedFromGitx = NO;
78-
cliArgs = nil;
79-
deferredSelectSha = nil;
80-
}
81-
/* Value Transformers */
82-
NSValueTransformer *transformer = [[PBNSURLPathUserDefaultsTransfomer alloc] init];
83-
[NSValueTransformer setValueTransformer:transformer forName:@"PBNSURLPathUserDefaultsTransfomer"];
84-
// Make sure the PBGitDefaults is initialized, by calling a random method
85-
[PBGitDefaults class];
86-
return self;
87-
}
88-
return self;
28+
29+
if(!(self = [super init]))
30+
return nil;
31+
32+
if(![[NSBundle bundleWithPath:@"/System/Library/Frameworks/Quartz.framework/Frameworks/QuickLookUI.framework"] load])
33+
if(![[NSBundle bundleWithPath:@"/System/Library/PrivateFrameworks/QuickLookUI.framework"] load])
34+
NSLog(@"Could not load QuickLook");
35+
36+
/* Value Transformers */
37+
NSValueTransformer *transformer = [[PBNSURLPathUserDefaultsTransfomer alloc] init];
38+
[NSValueTransformer setValueTransformer:transformer forName:@"PBNSURLPathUserDefaultsTransfomer"];
39+
40+
// Make sure the PBGitDefaults is initialized, by calling a random method
41+
[PBGitDefaults class];
42+
return self;
8943
}
9044

9145
- (void)registerServices
@@ -109,34 +63,16 @@ - (void)registerServices
10963

11064
- (void)applicationDidFinishLaunching:(NSNotification*)notification
11165
{
66+
[[SUUpdater sharedUpdater] setSendsSystemProfile:YES];
67+
11268
// Make sure Git's SSH password requests get forwarded to our little UI tool:
11369
setenv( "SSH_ASKPASS", [[[NSBundle mainBundle] pathForResource: @"gitx_askpasswd" ofType: @""] UTF8String], 1 );
11470
setenv( "DISPLAY", "localhost:0", 1 );
11571

116-
char * launchedfromgitx = getenv("GITX_LAUNCHED_FROM_CLI");
117-
char * cliargs = getenv("GITX_CLI_ARGUMENTS");
118-
119-
self.launchedFromGitx = (launchedfromgitx ? YES : NO);
120-
121-
if (cliargs) {
122-
self.cliArgs = [NSString stringWithUTF8String:(cliargs)];
123-
}
124-
125-
// NSLog(@"[%@ %s] launchedFromGitx = %@", [self class], _cmd, (launchedFromGitx ? @"YES" : @"NO"));
126-
// NSLog(@"[%@ %s] cliArgs = %@", [self class], _cmd, cliArgs);
127-
12872
[self registerServices];
12973

130-
if ([cliArgs isEqualToString:@"--all"]) {
131-
[PBGitDefaults setBranchFilter:kGitXAllBranchesFilter];
132-
[[NSUserDefaults standardUserDefaults] synchronize];
133-
} else if ([cliArgs isEqualToString:@"--local"]) {
134-
[PBGitDefaults setBranchFilter:kGitXLocalRemoteBranchesFilter];
135-
[[NSUserDefaults standardUserDefaults] synchronize];
136-
}
137-
13874
BOOL hasOpenedDocuments = NO;
139-
launchedDocuments = [[[PBRepositoryDocumentController sharedDocumentController] documents] copy];
75+
NSArray *launchedDocuments = [[[PBRepositoryDocumentController sharedDocumentController] documents] copy];
14076

14177
// Only try to open a default document if there are no documents open already.
14278
// For example, the application might have been launched by double-clicking a .git repository,
@@ -154,7 +90,7 @@ - (void)applicationDidFinishLaunching:(NSNotification*)notification
15490
}
15591
}
15692

157-
// Try to find the current directory, to open that as a repository...
93+
// Try to find the current directory, to open that as a repository
15894
if ([PBGitDefaults openCurDirOnLaunch] && !hasOpenedDocuments) {
15995
NSString *curPath = [[[NSProcessInfo processInfo] environment] objectForKey:@"PWD"];
16096
NSURL *url = nil;
@@ -166,47 +102,9 @@ - (void)applicationDidFinishLaunching:(NSNotification*)notification
166102
hasOpenedDocuments = YES;
167103
}
168104

169-
launchedDocuments = [[[PBRepositoryDocumentController sharedDocumentController] documents] copy];
170-
171-
// ...to bring the launched documents to the front
172-
for (PBGitRepository *document in launchedDocuments) {
173-
174-
PBGitWindowController * wc = [(PBGitRepository *)document windowController];
175-
PBGitHistoryController * historyViewController = wc.historyController;
176-
NSArrayController * ccontroller = historyViewController.commitController;
177-
178-
// determine what to show right after start - stage or standard history view?
179-
if ([cliArgs isEqualToString:@"--commit"] || [cliArgs isEqualToString:@"-c"]) {
180-
[wc showCommitView:self];
181-
launchedFromGitx = NO;
182-
} else {
183-
[wc showHistoryView:self];
184-
}
185-
186-
if ([cliArgs hasPrefix:@"--author"]) {
187-
NSArray * components = [cliArgs componentsSeparatedByString:@"="];
188-
NSString * author = [components objectAtIndex:1];
189-
[ccontroller setFilterPredicate:[NSPredicate predicateWithFormat:@"author contains[c] %@", author]];
190-
[historyViewController.commitList selectRowIndexes:[NSIndexSet indexSetWithIndex:0] byExtendingSelection:NO];
191-
} else if ([cliArgs hasPrefix:@"--subject"]) {
192-
NSArray * components = [cliArgs componentsSeparatedByString:@"="];
193-
NSString * subject = [components objectAtIndex:1];
194-
[ccontroller setFilterPredicate:[NSPredicate predicateWithFormat:@"subject contains[c] %@", subject]];
195-
} else if ([cliArgs hasPrefix:@"--sha"]) {
196-
NSArray * components = [cliArgs componentsSeparatedByString:@"="];
197-
NSString * sha = [components objectAtIndex:1];
198-
[ccontroller setFilterPredicate:[NSPredicate predicateWithFormat:@"realSha contains[c] %@", sha]];
199-
} else if ([cliArgs hasPrefix:@"-S"]) {
200-
NSString * subject = [cliArgs substringFromIndex:2];
201-
[ccontroller setFilterPredicate:[NSPredicate predicateWithFormat:@"subject contains[c] %@", subject]];
202-
}
203-
105+
// to bring the launched documents to the front
106+
for (PBGitRepository *document in launchedDocuments)
204107
[document showWindows];
205-
}
206-
207-
if (launchedFromGitx) {
208-
[self performSelector:@selector(finalizeCLILaunch:) withObject:self afterDelay:0.5];
209-
}
210108

211109
if (![[NSApplication sharedApplication] isActive])
212110
return;
@@ -217,42 +115,14 @@ - (void)applicationDidFinishLaunching:(NSNotification*)notification
217115
[[PBRepositoryDocumentController sharedDocumentController] openDocument:self];
218116
}
219117

220-
- (void) finalizeCLILaunch:(id)object {
221-
for (PBGitRepository * document in launchedDocuments) {
222-
BOOL success = [[[(PBGitRepository *)document windowController] historyController] selectCommit:self.deferredSelectSha];
223-
// NSLog(@"[%@ %s] trying to select commit with sha %@ (success = %@)", [self class], _cmd, self.deferredSelectSha, BMStringFromBOOL(success));
224-
if (success) {
225-
PBGitWindowController * wc = [(PBGitRepository *)document windowController];
226-
PBGitHistoryController * histController = wc.historyController;
227-
PBCommitList * clist = histController.commitList;
228-
// updating the selection with the selection seems redundant but it also updates the row select indicator
229-
[clist selectRowIndexes:[clist selectedRowIndexes] byExtendingSelection:NO];
230-
[histController scrollSelectionToTopOfViewFrom:0];
231-
[histController updateKeys];
232-
}
233-
}
234-
// Reset CLI indication status so KVO all over the controllers can go the intended ways again...
235-
self.deferredSelectSha = nil;
236-
self.launchedFromGitx = NO;
237-
}
238-
239-
240-
- (void) windowWillClose:(id)sender
118+
- (void) windowWillClose: sender
241119
{
242-
if ([[[sender object] windowController] isKindOfClass:[PBPrefsWindowController class]] ) {
243-
for (PBGitRepository * doc in [[PBRepositoryDocumentController sharedDocumentController] documents]) {
244-
[[[doc windowForSheet] contentView] setNeedsDisplay:YES];
245-
}
246-
} else {
247-
[firstResponder terminate: sender];
248-
}
120+
[firstResponder terminate: sender];
249121
}
250122

251123
- (IBAction)openPreferencesWindow:(id)sender
252124
{
253-
DBPrefsWindowController * prefsWindowController = [PBPrefsWindowController sharedPrefsWindowController];
254-
[[prefsWindowController window] setDelegate:self];
255-
[prefsWindowController showWindow:nil];
125+
[[PBPrefsWindowController sharedPrefsWindowController] showWindow:nil];
256126
}
257127

258128
- (IBAction)showAboutPanel:(id)sender
@@ -376,7 +246,7 @@ - (NSPersistentStoreCoordinator *) persistentStoreCoordinator {
376246
fileManager = [NSFileManager defaultManager];
377247
applicationSupportFolder = [self applicationSupportFolder];
378248
if ( ![fileManager fileExistsAtPath:applicationSupportFolder isDirectory:NULL] ) {
379-
[fileManager createDirectoryAtPath:applicationSupportFolder withIntermediateDirectories:YES attributes:nil error:nil];
249+
[fileManager createDirectoryAtPath:applicationSupportFolder attributes:nil];
380250
}
381251

382252
url = [NSURL fileURLWithPath: [applicationSupportFolder stringByAppendingPathComponent: @"GitTest.xml"]];

CWQuickLook.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_5
21
@interface QLPreviewPanel : NSPanel
32
+ (id)sharedPreviewPanel;
43

@@ -90,5 +89,4 @@
9089
- (void)setShowsAddToiPhoto:(BOOL)fp8;
9190
- (void)setShowsiChatTheater:(BOOL)fp8;
9291
- (void)setShowsFullscreen:(BOOL)fp8;
93-
@end
94-
#endif
92+
@end

DBPrefsWindowController.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
#import <Cocoa/Cocoa.h>
4343

4444

45-
@interface DBPrefsWindowController : NSWindowController <NSAnimationDelegate, NSToolbarDelegate> {
45+
@interface DBPrefsWindowController : NSWindowController {
4646
NSMutableArray *toolbarIdentifiers;
4747
NSMutableDictionary *toolbarViews;
4848
NSMutableDictionary *toolbarItems;

DBPrefsWindowController.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,13 @@ - (void)windowDidLoad
7474
// Create a new window to display the preference views.
7575
// If the developer attached a window to this controller
7676
// in Interface Builder, it gets replaced with this one.
77-
NSWindow *window = [[[NSWindow alloc] initWithContentRect:NSMakeRect(0,0,1000,1000)
77+
NSPanel *panel = [[[NSPanel alloc] initWithContentRect:NSMakeRect(0,0,1000,1000)
7878
styleMask:(NSTitledWindowMask |
7979
NSClosableWindowMask |
8080
NSMiniaturizableWindowMask)
8181
backing:NSBackingStoreBuffered
8282
defer:YES] autorelease];
83-
[self setWindow:window];
83+
[self setWindow:panel];
8484
contentSubview = [[[NSView alloc] initWithFrame:[[[self window] contentView] frame]] autorelease];
8585
[contentSubview setAutoresizingMask:(NSViewMinYMargin | NSViewWidthSizable)];
8686
[[[self window] contentView] addSubview:contentSubview];

0 commit comments

Comments
 (0)