Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New: Added option in xCodeCapp for displaying error in notification #2108

Merged
merged 7 commits into from
Apr 23, 2014
10 changes: 5 additions & 5 deletions Tools/XcodeCapp/XcodeCapp/AppController.m
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Loading