Skip to content

Commit

Permalink
Merge pull request #2108 from Dogild/xCodeCappOptionsNotification
Browse files Browse the repository at this point in the history
New: Added option in xCodeCapp for displaying error in notification
  • Loading branch information
primalmotion committed Apr 23, 2014
2 parents 0bd2a03 + e852827 commit fd35563
Show file tree
Hide file tree
Showing 7 changed files with 558 additions and 512 deletions.
10 changes: 5 additions & 5 deletions Tools/XcodeCapp/XcodeCapp/AppController.m
Expand Up @@ -111,7 +111,7 @@ - (void)applicationDidFinishLaunching:(NSNotification *)notification
[[NSApplication sharedApplication] terminate:self];
return;
}

// If we were opened from the command line, self.pathToOpenAtLaunch will be set.
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];

Expand Down Expand Up @@ -144,15 +144,15 @@ - (void)registerDefaultPreferences
kDefaultXCCAPIMode: [NSNumber numberWithInt:kXCCAPIModeAuto],
kDefaultXCCReactToInodeMod: @YES,
kDefaultXCCReopenLastProject: @YES,
kDefaultXCCAutoOpenErrorsPanelOnWarnings: @YES,
kDefaultXCCAutoOpenErrorsPanelOnErrors: @YES,
kDefaultXCCAutoOpenErrorsPanelOnCappLint: @YES,
kDefaultXCCAutoShowNotificationOnErrors: @YES,
kDefaultXCCAutoShowNotificationOnCappLint: @NO,
kDefaultXCCProjectHistory: [NSArray new],
kDefaultMaxRecentProjects: @20,
kDefaultLogLevel: [NSNumber numberWithInt:LOG_LEVEL_WARN],
kDefaultAutoOpenXcodeProject: @YES,
kDefaultShowProcessingNotices: @YES,
kDefaultUseSymlinkWhenCreatingProject: @YES,
KDefaultUsesCappLintForEveryNotifications: @NO
kDefaultUseSymlinkWhenCreatingProject: @YES
};

NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
Expand Down
20 changes: 16 additions & 4 deletions Tools/XcodeCapp/XcodeCapp/ProcessSourceOperation.m
Expand Up @@ -152,12 +152,24 @@ - (void)main
[self postErrorNotificationForPath:self.sourcePath line:0 message:response status:status];
}
}

[self notifyUserWithTitle:notificationTitle message:notificationMessage];

if ([self.xcc shouldShowErrorNotification])
[self notifyUserWithTitle:notificationTitle message:notificationMessage];
}
else if (!self.xcc.isLoadingProject)
{
[self notifyUserWithTitle:notificationTitle message:notificationMessage];
BOOL showFinalNotification = YES;

if ([self.xcc shouldProcessWithCappLint])
{
showFinalNotification = [self.xcc checkCappLintForPath:[NSArray arrayWithObject:self.sourcePath]];

if (!showFinalNotification)
[self.xcc showCappLintErrors];
}

if (showFinalNotification)
[self notifyUserWithTitle:notificationTitle message:notificationMessage];
}
}

Expand All @@ -178,7 +190,7 @@ - (void)postErrorNotificationForPath:(NSString *)path line:(int)line message:(NS
nil];

info[@"projectId"] = self.projectId;
info[@"message"] = [NSString stringWithFormat:@"%@, line %d\n%@", [self.sourcePath lastPathComponent], 0, message];
info[@"message"] = [NSString stringWithFormat:@"Compilation issue: %@, line %d\n%@", [self.sourcePath lastPathComponent], 0, message];

if (self.isCancelled)
return;
Expand Down
6 changes: 3 additions & 3 deletions Tools/XcodeCapp/XcodeCapp/UserDefaults.h
Expand Up @@ -17,16 +17,16 @@ extern NSString * const kDefaultFirstLaunchVersion;
extern NSString * const kDefaultXCCAPIMode;
extern NSString * const kDefaultXCCReactToInodeMod;
extern NSString * const kDefaultXCCReopenLastProject;
extern NSString * const kDefaultXCCAutoOpenErrorsPanelOnWarnings;
extern NSString * const kDefaultXCCAutoOpenErrorsPanelOnErrors;
extern NSString * const kDefaultXCCAutoOpenErrorsPanelOnCappLint;
extern NSString * const kDefaultXCCAutoShowNotificationOnErrors;
extern NSString * const kDefaultXCCAutoShowNotificationOnCappLint;
extern NSString * const kDefaultXCCProjectHistory;
extern NSString * const kDefaultLastOpenedPath;
extern NSString * const kDefaultPathModificationDates;
extern NSString * const kDefaultMaxRecentProjects;
extern NSString * const kDefaultLogLevel;
extern NSString * const kDefaultAutoOpenXcodeProject;
extern NSString * const kDefaultShowProcessingNotices;
extern NSString * const kDefaultUseSymlinkWhenCreatingProject;
extern NSString * const KDefaultUsesCappLintForEveryNotifications;

#endif
6 changes: 3 additions & 3 deletions Tools/XcodeCapp/XcodeCapp/UserDefaults.m
Expand Up @@ -15,14 +15,14 @@
NSString * const kDefaultXCCAPIMode = @"XCCAPIMode";
NSString * const kDefaultXCCReactToInodeMod = @"XCCReactMode";
NSString * const kDefaultXCCReopenLastProject = @"XCCReopenLastProject";
NSString * const kDefaultXCCAutoOpenErrorsPanelOnWarnings = @"XCCAutoOpenErrorsPanelOnWarnings";
NSString * const kDefaultXCCAutoOpenErrorsPanelOnErrors = @"XCCAutoOpenErrorsPanelOnErrors";
NSString * const kDefaultXCCAutoOpenErrorsPanelOnCappLint = @"XCCAutoOpenErrorsPanelOnCappLint";
NSString * const kDefaultXCCAutoShowNotificationOnErrors = @"XCCAutoOpenShowNotificationErrors";
NSString * const kDefaultXCCAutoShowNotificationOnCappLint = @"XCCAutoShowNotificationOnCappLint";
NSString * const kDefaultXCCProjectHistory = @"XCCProjectHistory";
NSString * const kDefaultLastOpenedPath = @"LastOpenedPath";
NSString * const kDefaultPathModificationDates = @"pathModificationDates";
NSString * const kDefaultMaxRecentProjects = @"maxRecentProjects";
NSString * const kDefaultLogLevel = @"logLevel";
NSString * const kDefaultAutoOpenXcodeProject = @"autoOpenXcodeProject";
NSString * const kDefaultShowProcessingNotices = @"showProcessingNotices";
NSString * const kDefaultUseSymlinkWhenCreatingProject = @"useSymlinkWhenCreatingProject";
NSString * const KDefaultUsesCappLintForEveryNotifications = @"usesCappLintForEveryNotifications";
12 changes: 11 additions & 1 deletion Tools/XcodeCapp/XcodeCapp/XcodeCapp.h
Expand Up @@ -45,7 +45,8 @@ enum {
extern NSString * const XCCConversionDidStartNotification;
extern NSString * const XCCConversionDidEndNotification;
extern NSString * const XCCProjectDidFinishLoadingNotification;

extern NSString * const XCCCappLintDidStartNotification;
extern NSString * const XCCCappLintDidEndNotification;

@interface XcodeCapp : NSObject <NSTableViewDelegate, NSUserNotificationCenterDelegate, GrowlApplicationBridgeDelegate>

Expand Down Expand Up @@ -109,6 +110,9 @@ extern NSString * const XCCProjectDidFinishLoadingNotification;
// A list of errors generated from the current batch of source processing
@property NSMutableArray *errorList;

// A list of files name who can be processed, based on xcapp-ignore and path pf the project
@property NSMutableArray *xCodeCappTargetedFiles;

// Panel, table and controller used to display errors
@property (strong) IBOutlet NSPanel *errorsPanel;
@property (unsafe_unretained) IBOutlet NSTableView *errorTable;
Expand All @@ -132,6 +136,8 @@ extern NSString * const XCCProjectDidFinishLoadingNotification;
- (BOOL)isXibFile:(NSString *)path;
- (BOOL)isXCCIgnoreFile:(NSString *)path;

- (BOOL)shouldShowErrorNotification;

- (NSString *)shadowBasePathForProjectSourcePath:(NSString *)path;
- (BOOL)hasErrors;

Expand All @@ -143,6 +149,10 @@ extern NSString * const XCCProjectDidFinishLoadingNotification;

- (NSDictionary*)createProject:(NSString*)aPath;

- (BOOL)shouldProcessWithCappLint;
- (BOOL)checkCappLintForPath:(NSArray*)paths;
- (void)showCappLintErrors;

@end

@interface XcodeCapp (SnowLeopard)
Expand Down

0 comments on commit fd35563

Please sign in to comment.