Permalink
Browse files

Conversion to modern Objective-C.

— Requires Xcode 4.4 for later to compile.
— Literal conversion for dictionaries, arrays, etc. Our helper class methods were not replaced during process. It is not decided if they are worth the time to convert.
— Defined types for our enum declarations for code competition in Xcode.
— Automatic synthesize properties. Instance variables are now the property name prefixed by an underscore.
  • Loading branch information...
1 parent 074f044 commit a9dcfadbc7c52f6c5e862ae51b469b8df6212941 @emsquared emsquared committed Jun 24, 2012
Showing with 701 additions and 1,367 deletions.
  1. +2 −2 Classes/Controllers/TXGlobalModels.m
  2. +24 −54 Classes/Controllers/TXMasterController.m
  3. +0 −21 Classes/Controllers/TXMenuController.m
  4. +6 −39 Classes/Dialogs/Preferences/TDCPreferencesController.m
  5. +0 −2 Classes/Dialogs/Preferences/TDCPreferencesScriptWrapper.m
  6. +0 −6 Classes/Dialogs/Preferences/TDCPreferencesSoundWrapper.m
  7. +1 −3 Classes/Dialogs/TDCAboutPanel.m
  8. +0 −15 Classes/Dialogs/TDCAddressBookSheet.m
  9. +0 −4 Classes/Dialogs/TDCHighlightSheet.m
  10. +0 −5 Classes/Dialogs/TDCInviteSheet.m
  11. +2 −12 Classes/Dialogs/TDCListDialog.m
  12. +0 −15 Classes/Dialogs/TDCModeSheet.m
  13. +0 −5 Classes/Dialogs/TDCNickSheet.m
  14. +15 −74 Classes/Dialogs/TDCServerSheet.m
  15. +0 −5 Classes/Dialogs/TDCSheetBase.m
  16. +0 −5 Classes/Dialogs/TDCTopicSheet.m
  17. +4 −13 Classes/Dialogs/TDCWelcomeSheet.m
  18. +1 −6 Classes/Dialogs/TDChanBanExceptionSheet.m
  19. +1 −6 Classes/Dialogs/TDChanBanSheet.m
  20. +1 −6 Classes/Dialogs/TDChanInviteExceptionSheet.m
  21. +0 −21 Classes/Dialogs/TDChannelSheet.m
  22. +1 −1 Classes/Headers/External Libraries/DDInvocation.h
  23. +1 −1 Classes/Headers/IRCAddressBook.h
  24. +1 −1 Classes/Headers/IRCChannel.h
  25. +1 −1 Classes/Headers/IRCChannelConfig.h
  26. +2 −2 Classes/Headers/IRCClient.h
  27. +1 −1 Classes/Headers/IRCClientConfig.h
  28. +1 −1 Classes/Headers/IRCColorFormat.h
  29. +1 −1 Classes/Headers/TLOGrowlController.h
  30. +6 −6 Classes/Headers/TPCPreferences.h
  31. +2 −2 Classes/Headers/TVCLogLine.h
  32. +1 −1 Classes/Headers/TVCLogRenderer.h
  33. +10 −10 Classes/Helpers/Cocoa (Objective-C)/NSArrayHelper.m
  34. +13 −15 Classes/Helpers/Cocoa (Objective-C)/NSBundleHelper.m
  35. +16 −16 Classes/Helpers/Cocoa (Objective-C)/NSDictionaryHelper.m
  36. +1 −1 Classes/Helpers/Cocoa (Objective-C)/NSPasteboardHelper.m
  37. +2 −2 Classes/Helpers/Cocoa (Objective-C)/NSSplitViewHelper.m
  38. +4 −4 Classes/Helpers/Cocoa (Objective-C)/NSStringHelper.m
  39. +11 −13 Classes/Helpers/THOPluginItem.m
  40. +0 −5 Classes/Helpers/Threading/DDInvocation.m
  41. +2 −14 Classes/IRC/Address Book/IRCAddressBook.m
  42. +0 −19 Classes/IRC/IRCChannel.m
  43. +0 −11 Classes/IRC/IRCChannelConfig.m
  44. +1 −4 Classes/IRC/IRCChannelMode.m
  45. +35 −98 Classes/IRC/IRCClient.m
  46. +21 −54 Classes/IRC/IRCClientConfig.m
  47. +0 −18 Classes/IRC/IRCConnection.m
  48. +13 −16 Classes/IRC/IRCExtras.m
  49. +0 −8 Classes/IRC/IRCISupportInfo.m
  50. +0 −5 Classes/IRC/IRCMessage.m
  51. +0 −5 Classes/IRC/IRCModeInfo.m
  52. +0 −5 Classes/IRC/IRCPrefix.m
  53. +1 −5 Classes/IRC/IRCSendingMessage.m
  54. +0 −16 Classes/IRC/IRCTreeItem.m
  55. +7 −26 Classes/IRC/IRCUser.m
  56. +6 −41 Classes/IRC/IRCWorld.m
  57. +2 −3 Classes/IRC/IRCWorldConfig.m
  58. +26 −26 Classes/Library/Color Formatting/IRCColorFormat.m
  59. +1 −1 Classes/Library/External Libraries/Keychain Control/AGKeychain.m
  60. +11 −11 Classes/Library/External Libraries/Regular Expression/RegexKitLite.m
  61. +130 −130 Classes/Library/External Libraries/Sockets/GCDAsyncSocket.m
  62. +27 −28 Classes/Library/External Libraries/Sockets/GCDAsyncSocketExtensions.m
  63. +0 −4 Classes/Library/TLOFileLogger.m
  64. +1 −3 Classes/Library/TLOFileWithContent.m
  65. +6 −10 Classes/Library/TLOGrowlController.m
  66. +1 −4 Classes/Library/TLOInputHistory.m
  67. +18 −21 Classes/Library/TLOKeyEventHandler.m
  68. +1 −1 Classes/Library/TLOLanguagePreferences.m
  69. +1 −1 Classes/Library/TLOLinkParser.m
  70. +0 −2 Classes/Library/TLONickCompletionStatus.m
  71. +6 −6 Classes/Library/TLOPopupPrompts.m
  72. +0 −19 Classes/Library/TLOSocketClient.m
  73. +0 −5 Classes/Library/TLOTimer.m
  74. +0 −3 Classes/Library/TLOTimerCommand.m
  75. +1 −1 Classes/Library/TLOpenLink.m
  76. +24 −24 Classes/Preferences/Migration Assistant/TPCPreferencesMigrationAssistant.m
  77. +115 −115 Classes/Preferences/TPCPreferences.m
  78. +9 −17 Classes/Preferences/Themes/TPCOtherTheme.m
  79. +8 −13 Classes/Preferences/Themes/TPCViewTheme.m
  80. +4 −4 Classes/Views/Channel View/LVCLogRenderer.m
  81. +26 −57 Classes/Views/Channel View/TVCLogController.m
  82. +0 −11 Classes/Views/Channel View/TVCLogLine.m
  83. +2 −10 Classes/Views/Channel View/TVCLogPolicy.m
  84. +0 −5 Classes/Views/Channel View/TVCLogScriptEventSink.m
  85. +1 −3 Classes/Views/Channel View/TVCLogView.m
  86. +1 −4 Classes/Views/Channel View/TVCWebViewAutoScroll.m
  87. +6 −10 Classes/Views/Input Text Field/TVCInputTextField.m
  88. +2 −4 Classes/Views/Input Text Field/TVCTextField.m
  89. +5 −10 Classes/Views/Input Text Field/TVCTextFormatterMenu.m
  90. +0 −1 Classes/Views/Server List/TVCServerList.m
  91. +2 −4 Classes/Views/Server List/TVCServerListCell.m
  92. +2 −2 Classes/Views/TVCDockIcon.m
  93. +0 −8 Classes/Views/TVCInputPromptDialog.m
  94. +0 −2 Classes/Views/TVCListView.m
  95. +0 −1 Classes/Views/TVCMainWindow.m
  96. +1 −3 Classes/Views/TVCMainWindowSegmentedControl.m
  97. +10 −15 Classes/Views/TVCThinSplitView.m
  98. +0 −1 Classes/Views/User List/TVCMemberList.m
  99. +2 −5 Classes/Views/User List/TVCMemberListCell.m
  100. +29 −9 Main Project (Textual).xcodeproj/project.pbxproj
  101. +2 −2 Resources/Info.plist
@@ -62,7 +62,7 @@ BOOL NSObjectIsNotEmpty(id obj)
NSString *TXSpecialReadableTime(NSInteger dateInterval, BOOL shortValue, NSArray *orderMatrix)
{
if (NSObjectIsEmpty(orderMatrix)) {
- orderMatrix = [NSArray arrayWithObjects:@"year", @"month", @"week", @"day", @"hour", @"minute", @"second", nil];
+ orderMatrix = @[@"year", @"month", @"week", @"day", @"hour", @"minute", @"second"];
}
NSCalendar *sysCalendar = [NSCalendar currentCalendar];
@@ -124,7 +124,7 @@ NSInteger TXRandomNumber(NSInteger maxset)
NSString *TXFormattedNumber(NSInteger number)
{
- NSNumber *numberbar = [NSNumber numberWithInteger:number];
+ NSNumber *numberbar = @(number);
return [NSNumberFormatter localizedStringFromNumber:numberbar numberStyle:kCFNumberFormatterDecimalStyle];
}
@@ -20,35 +20,6 @@ - (void)buildSegmentedController;
@implementation TXMasterController
-@synthesize addServerButton;
-@synthesize chanMenu;
-@synthesize channelMenu;
-@synthesize completionStatus;
-@synthesize extrac;
-@synthesize formattingMenu;
-@synthesize ghostMode;
-@synthesize growl;
-@synthesize inputHistory;
-@synthesize logBase;
-@synthesize logMenu;
-@synthesize memberList;
-@synthesize memberSplitView;
-@synthesize memberSplitViewOldPosition;
-@synthesize memberMenu;
-@synthesize menu;
-@synthesize serverList;
-@synthesize serverMenu;
-@synthesize serverSplitView;
-@synthesize terminating;
-@synthesize text;
-@synthesize treeMenu;
-@synthesize urlMenu;
-@synthesize viewTheme;
-@synthesize welcomeSheet;
-@synthesize window;
-@synthesize windowButtonController;
-@synthesize windowButtonControllerCell;
-@synthesize world;
#pragma mark -
#pragma mark NSApplication Delegate
@@ -233,7 +204,7 @@ - (void)applicationDidBecomeActive:(NSNotification *)note
[self.world reloadTree];
- [text.backgroundView setWindowIsActive:YES];
+ [_text.backgroundView setWindowIsActive:YES];
}
- (void)applicationDidResignActive:(NSNotification *)note
@@ -248,7 +219,7 @@ - (void)applicationDidResignActive:(NSNotification *)note
[self.world reloadTree];
- [text.backgroundView setWindowIsActive:NO];
+ [_text.backgroundView setWindowIsActive:NO];
}
- (BOOL)applicationShouldHandleReopen:(NSApplication *)sender hasVisibleWindows:(BOOL)flag
@@ -490,8 +461,8 @@ - (CGFloat)splitView:(NSSplitView *)splitView
ofSubviewAt:(NSInteger)dividerIndex
{
if ([splitView isEqual:self.memberSplitView]) {
- NSView *leftSide = [[splitView subviews] objectAtIndex:0];
- NSView *rightSide = [[splitView subviews] objectAtIndex:1];
+ NSView *leftSide = [splitView subviews][0];
+ NSView *rightSide = [splitView subviews][1];
NSInteger leftWidth = [leftSide bounds].size.width;
NSInteger rightWidth = [rightSide bounds].size.width;
@@ -507,8 +478,8 @@ - (CGFloat)splitView:(NSSplitView *)splitView
ofSubviewAt:(NSInteger)dividerIndex
{
if ([splitView isEqual:self.memberSplitView]) {
- NSView *leftSide = [[splitView subviews] objectAtIndex:0];
- NSView *rightSide = [[splitView subviews] objectAtIndex:1];
+ NSView *leftSide = [splitView subviews][0];
+ NSView *rightSide = [splitView subviews][1];
NSInteger leftWidth = [leftSide bounds].size.width;
NSInteger rightWidth = [rightSide bounds].size.width;
@@ -522,13 +493,13 @@ - (CGFloat)splitView:(NSSplitView *)splitView
- (BOOL)splitView:(NSSplitView *)splitView canCollapseSubview:(NSView *)subview
{
if ([splitView isEqual:self.memberSplitView]) {
- NSView *leftSide = [[splitView subviews] objectAtIndex:0];
+ NSView *leftSide = [splitView subviews][0];
if ([leftSide isEqual:subview]) {
return NO;
}
} else if ([splitView isEqual:self.serverSplitView]) {
- NSView *rightSide = [[splitView subviews] objectAtIndex:1];
+ NSView *rightSide = [splitView subviews][1];
if ([rightSide isEqual:subview] || NSObjectIsEmpty(self.world.clients)) {
return NO;
@@ -980,7 +951,7 @@ - (void)completeNick:(BOOL)forward
#pragma mark -
#pragma mark Keyboard Navigation
-typedef enum {
+typedef enum TXMoveKind : NSInteger {
TXMoveUpKind,
TXMoveDownKind,
TXMoveLeftKind,
@@ -1365,8 +1336,8 @@ - (void)updateSegmentedController
[self.windowButtonController setEnabled:(self.world.clients.count >= 1)];
/* Selection Settings. */
- IRCClient *u = world.selectedClient;
- IRCChannel *c = world.selectedChannel;
+ IRCClient *u = self.world.selectedClient;
+ IRCChannel *c = self.world.selectedChannel;
if (PointerIsEmpty(c)) {
[self.windowButtonController setMenu:self.serverMenu.submenu forSegment:1];
@@ -1380,7 +1351,7 @@ - (void)updateSegmentedController
- (void)buildSegmentedController
{
- self.windowButtonControllerCell.menuController = menu;
+ self.windowButtonControllerCell.menuController = self.menu;
[self.windowButtonController setEnabled:(self.world.clients.count >= 1)];
@@ -1408,24 +1379,23 @@ - (void)welcomeSheet:(TDCWelcomeSheet *)sender onOK:(NSDictionary *)config
NSMutableDictionary *dic = [NSMutableDictionary dictionary];
- for (NSString *s in [config objectForKey:@"channelList"]) {
+ for (NSString *s in config[@"channelList"]) {
if ([s isChannelName]) {
- [channels safeAddObject:[NSDictionary dictionaryWithObjectsAndKeys:
- s, @"channelName",
- NSNumberWithBOOL(YES), @"joinOnConnect",
- NSNumberWithBOOL(YES), @"enableNotifications", nil]];
+ [channels safeAddObject:@{@"channelName": s,
+ @"joinOnConnect": NSNumberWithBOOL(YES),
+ @"enableNotifications": NSNumberWithBOOL(YES)}];
}
}
- NSString *host = [config objectForKey:@"serverAddress"];
- NSString *nick = [config objectForKey:@"identityNickname"];
+ NSString *host = config[@"serverAddress"];
+ NSString *nick = config[@"identityNickname"];
- [dic setObject:host forKey:@"serverAddress"];
- [dic setObject:host forKey:@"connectionName"];
- [dic setObject:nick forKey:@"identityNickname"];
- [dic setObject:channels forKey:@"channelList"];
- [dic setObject:[config objectForKey:@"connectOnLaunch"] forKey:@"connectOnLaunch"];
- [dic setObject:NSNumberWithLong(NSUTF8StringEncoding) forKey:@"characterEncodingDefault"];
+ dic[@"serverAddress"] = host;
+ dic[@"connectionName"] = host;
+ dic[@"identityNickname"] = nick;
+ dic[@"channelList"] = channels;
+ dic[@"connectOnLaunch"] = config[@"connectOnLaunch"];
+ dic[@"characterEncodingDefault"] = NSNumberWithLong(NSUTF8StringEncoding);
[self.window makeKeyAndOrderFront:nil];
@@ -22,27 +22,6 @@ - (TVCLogView *)currentWebView;
@implementation TXMenuController
-@synthesize aboutPanel;
-@synthesize channelSheet;
-@synthesize closeWindowItem;
-@synthesize currentSearchPhrase;
-@synthesize highlightSheet;
-@synthesize inviteSheet;
-@synthesize isInFullScreenMode;
-@synthesize master;
-@synthesize memberList;
-@synthesize modeSheet;
-@synthesize nickSheet;
-@synthesize pointedChannelName;
-@synthesize pointedNick;
-@synthesize pointedUrl;
-@synthesize preferencesController;
-@synthesize serverList;
-@synthesize serverSheet;
-@synthesize text;
-@synthesize topicSheet;
-@synthesize window;
-@synthesize world;
- (id)init
{
@@ -26,40 +26,7 @@ - (void)updateTranscriptFolder;
@implementation TDCPreferencesController
-@synthesize sounds;
-@synthesize alertsView;
-@synthesize channelManagementView;
-@synthesize contentView;
-@synthesize delegate;
-@synthesize excludeWordsArrayController;
-@synthesize excludeWordsTable;
-@synthesize experimentalSettingsView;
-@synthesize floodControlView;
-@synthesize generalView;
-@synthesize highlightView;
-@synthesize identityView;
-@synthesize installedScriptsMenu;
-@synthesize installedScriptsTable;
-@synthesize interfaceView;
-@synthesize IRCopServicesView;
-@synthesize keywordsArrayController;
-@synthesize keywordsTable;
-@synthesize logView;
-@synthesize world;
-@synthesize preferenceSelectToolbar;
-@synthesize scriptLocationField;
-@synthesize scriptsController;
@synthesize scriptsView;
-@synthesize stylesView;
-@synthesize themeButton;
-@synthesize alertButton;
-@synthesize alertSoundButton;
-@synthesize highlightNicknameButton;
-@synthesize transcriptFolderButton;
-@synthesize addExcludeWordButton;
-@synthesize useGrowlButton;
-@synthesize disableAlertWhenAwayButton;
-@synthesize availableSounds;
- (id)initWithWorldController:(IRCWorld *)word
{
@@ -110,8 +77,8 @@ - (NSArray *)toolbarDefaultItemIdentifiers:(NSToolbar *)toolbar
{
NSString *addonID = ((NSObjectIsNotEmpty(self.world.bundlesWithPreferences)) ? @"13" : @"10");
- return [NSArray arrayWithObjects:@"0", NSToolbarFlexibleSpaceItemIdentifier, @"3", @"1",
- @"4", @"2", @"9", NSToolbarFlexibleSpaceItemIdentifier, addonID, @"11", nil];
+ return @[@"0", NSToolbarFlexibleSpaceItemIdentifier, @"3", @"1",
+ @"4", @"2", @"9", NSToolbarFlexibleSpaceItemIdentifier, addonID, @"11"];
}
- (void)setUpToolbarItemsAndMenus
@@ -364,7 +331,7 @@ - (NSArray *)availableSounds
- (NSMutableArray *)sounds
{
- if (NSObjectIsEmpty(sounds)) {
+ if (NSObjectIsEmpty(_sounds)) {
NSMutableArray *ary = [NSMutableArray new];
[ary addObject:[TDCPreferencesSoundWrapper soundWrapperWithEventType:TXNotificationConnectType]];
@@ -382,7 +349,7 @@ - (NSMutableArray *)sounds
self.sounds = ary;
}
- return sounds;
+ return _sounds;
}
#pragma mark -
@@ -443,7 +410,7 @@ - (void)updateTheme
NSInteger tag = 0;
- NSArray *ary = [NSArray arrayWithObjects:[TPCPreferences whereThemesLocalPath], [TPCPreferences whereThemesPath], nil];
+ NSArray *ary = @[[TPCPreferences whereThemesLocalPath], [TPCPreferences whereThemesPath]];
for (NSString *path in ary) {
NSMutableSet *set = [NSMutableSet set];
@@ -555,7 +522,7 @@ - (void)changeItemFont:(NSFontManager *)sender
[TPCPreferences setThemeChannelViewFontSize:[newFont pointSize]];
[self setValue:[newFont fontName] forKey:@"themeChannelViewFontName"];
- [self setValue:NSNumberWithDouble([newFont pointSize]) forKey:@"themeChannelViewFontSize"];
+ [self setValue:@([newFont pointSize]) forKey:@"themeChannelViewFontSize"];
[self onStyleChanged:nil];
}
@@ -6,8 +6,6 @@
@implementation TDCPreferencesScriptWrapper
-@synthesize scripts;
-@synthesize world;
- (id)init
{
@@ -6,12 +6,6 @@
@implementation TDCPreferencesSoundWrapper
-@synthesize eventType;
-@synthesize displayName;
-@synthesize sound;
-@synthesize growl;
-@synthesize growlSticky;
-@synthesize disableWhileAway;
- (id)initWithEventType:(TXNotificationType)aEventType
{
@@ -6,8 +6,6 @@
@implementation TDCAboutPanel
-@synthesize delegate;
-@synthesize versionInfo;
- (id)init
{
@@ -21,7 +19,7 @@ - (id)init
- (void)show
{
[self.versionInfo setStringValue:[NSString stringWithFormat:TXTLS(@"AboutWindowBuildNumber"),
- [[TPCPreferences textualInfoPlist] objectForKey:@"CFBundleVersion"]]];
+ [TPCPreferences textualInfoPlist][@"CFBundleVersion"]]];
[self.window center];
[self.window makeKeyAndOrderFront:nil];
@@ -11,21 +11,6 @@ - (void)reloadChannelTable;
@implementation TDCAddressBookSheet
-@synthesize ignore;
-@synthesize delegate;
-@synthesize newItem;
-@synthesize hostmask;
-@synthesize nickname;
-@synthesize ignorePublicMsg;
-@synthesize ignorePrivateMsg;
-@synthesize ignoreHighlights;
-@synthesize ignoreNotices;
-@synthesize ignoreCTCP;
-@synthesize ignoreJPQE;
-@synthesize notifyJoins;
-@synthesize ignorePMHighlights;
-@synthesize ignoreWindow;
-@synthesize notifyWindow;
- (id)init
{
@@ -12,10 +12,6 @@ - (void)reloadTable;
@implementation TDCHighlightSheet
-@synthesize list;
-@synthesize table;
-@synthesize header;
-@synthesize delegate;
- (id)init
{
@@ -7,11 +7,6 @@
@implementation TDCInviteSheet
-@synthesize delegate;
-@synthesize nicks;
-@synthesize uid;
-@synthesize titleLabel;
-@synthesize channelPopup;
- (id)init
{
Oops, something went wrong.

0 comments on commit a9dcfad

Please sign in to comment.