From c4c56f3091bf871bfa241ec9d61cb869f4abc301 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C3=ABl=20Warnault?= Date: Thu, 30 Apr 2020 13:49:22 +0200 Subject: [PATCH] Clean theme dead code and fix debug console colors for DM --- Sources/WCApplicationController.m | 6 +- Sources/WCChatController.m | 3 +- Sources/WCConsole.m | 21 +- Sources/WCPreferences.h | 32 +- Sources/WCPreferences.m | 740 +----------------- Sources/WCThemesPreferences.h | 29 - Sources/WCThemesPreferences.m | 221 ------ WiredClient.xcodeproj/project.pbxproj | 12 +- .../xcschemes/xcschememanagement.plist | 4 +- de.lproj/Preferences.xib | 229 ++---- en.lproj/Preferences.xib | 294 +++---- fr.lproj/Preferences.xib | 96 --- 12 files changed, 212 insertions(+), 1475 deletions(-) delete mode 100644 Sources/WCThemesPreferences.h delete mode 100644 Sources/WCThemesPreferences.m diff --git a/Sources/WCApplicationController.m b/Sources/WCApplicationController.m index 66c0936a..9705af22 100644 --- a/Sources/WCApplicationController.m +++ b/Sources/WCApplicationController.m @@ -792,11 +792,7 @@ - (BOOL)application:(NSApplication *)application openFile:(NSString *)filename { extension = [filename pathExtension]; - if([extension isEqualToString:@"WiredTheme"]) - return [[WCPreferences preferences] importThemeFromFile:filename]; - else if([extension isEqualToString:@"WiredTemplate"]) - return [[WCPreferences preferences] importTemplateFromFile:filename]; - else if([extension isEqualToString:@"WiredBookmarks"]) + if([extension isEqualToString:@"WiredBookmarks"]) return [[WCPreferences preferences] importBookmarksFromFile:filename]; else if([extension isEqualToString:@"WiredTrackerBookmarks"]) return [[WCPreferences preferences] importTrackerBookmarksFromFile:filename]; diff --git a/Sources/WCChatController.m b/Sources/WCChatController.m index 28302c88..14e27b8e 100644 --- a/Sources/WCChatController.m +++ b/Sources/WCChatController.m @@ -321,7 +321,8 @@ - (void)_printChat:(NSString *)chat by:(WCUser *)user { nick, @"nick", mutableOutput, @"message", nil]; - NSLog(@"jsonProxy : %@", jsonProxy); + + //NSLog(@"jsonProxy : %@", jsonProxy); [_chatOutputWebView stringByEvaluatingJavaScriptFromString: [NSSWF:@"printMessage(%@);", [_jsonWriter stringWithObject:jsonProxy]]]; diff --git a/Sources/WCConsole.m b/Sources/WCConsole.m index 5d1f1e91..d9224395 100644 --- a/Sources/WCConsole.m +++ b/Sources/WCConsole.m @@ -30,7 +30,7 @@ #import "WCConsole.h" #import "WCServerConnection.h" -#define WCConsoleMaxLength 1048576 +#define WCConsoleMaxLength 1048576 @interface WCConsole(Private) @@ -91,12 +91,13 @@ - (void)_log:(NSString *)string color:(NSColor *)color { CGFloat position; if(!font) - font = [[NSFont fontWithName:@"Monaco" size:9.0] retain]; + font = [[NSFont fontWithName:@"Menlo" size:11.0] retain]; // attributes = [NSDictionary dictionaryWithObjectsAndKeys: color, NSForegroundColorAttributeName, font, NSFontAttributeName, NULL]; + attributedString = [NSAttributedString attributedStringWithString:string attributes:attributes]; position = [[_consoleScrollView verticalScroller] floatValue]; @@ -138,38 +139,38 @@ - (void)windowDidLoad { #pragma mark - - (void)linkConnectionReceivedMessage:(NSNotification *)notification { - [self _log:[[notification object] description] color:[NSColor blueColor]]; + [self _log:[[notification object] description] color:[NSColor systemBlueColor]]; // } - (void)linkConnectionReceivedErrorMessage:(NSNotification *)notification { - [self _log:[[notification object] description] color:[NSColor redColor]]; + [self _log:[[notification object] description] color:[NSColor systemRedColor]]; // } - (void)linkConnectionReceivedInvalidMessage:(NSNotification *)notification { - [self _log:[[notification object] description] color:[NSColor redColor]]; - [self _log:[[[notification userInfo] objectForKey:@"WCError"] localizedDescription] color:[NSColor redColor]]; + [self _log:[[notification object] description] color:[NSColor systemRedColor]]; // + [self _log:[[[notification userInfo] objectForKey:@"WCError"] localizedDescription] color:[NSColor systemRedColor]]; // } - (void)linkConnectionSentMessage:(NSNotification *)notification { - [self _log:[[notification object] description] color:[NSColor blackColor]]; + [self _log:[[notification object] description] color:[NSColor controlTextColor]]; // } - (void)exceptionHandlerReceivedBacktrace:(NSNotification *)notification { - [self _log:[notification object] color:[NSColor redColor]]; + [self _log:[notification object] color:[NSColor systemRedColor]]; // } - (void)exceptionHandlerReceivedException:(NSNotification *)notification { - [self _log:[[notification object] description] color:[NSColor redColor]]; + [self _log:[[notification object] description] color:[NSColor systemRedColor]]; // } @@ -181,7 +182,7 @@ - (void)log:(NSString *)format, ... { va_start(ap, format); - [self _log:[NSString stringWithFormat:format arguments:ap] color:[NSColor redColor]]; + [self _log:[NSString stringWithFormat:format arguments:ap] color:[NSColor systemRedColor]]; // va_end(ap); } diff --git a/Sources/WCPreferences.h b/Sources/WCPreferences.h index 4c671ef6..32c9e277 100644 --- a/Sources/WCPreferences.h +++ b/Sources/WCPreferences.h @@ -66,21 +66,6 @@ extern NSString * const WCIconDidChangeNotification; IBOutlet NSMatrix *_threadsSplitViewMatrix; - IBOutlet NSWindow *_themesWindow; - IBOutlet NSWindow *_addThemeWindow; - IBOutlet NSWindow *_manageThemesWindow; - IBOutlet NSTextField *_addThemeNameTextField; - IBOutlet NSPopUpButton *_themesPopUpButton; - IBOutlet NSButton *_addThemeButton; - IBOutlet NSButton *_deleteThemeButton; - IBOutlet NSButton *_selectThemeButton; - IBOutlet NSButton *_customizeThemesButton; - - IBOutlet NSPopUpButton *_themesTemplatesPopUpButton; - IBOutlet NSWindow *_themesTemplatesWindow; - IBOutlet NSTableView *_themesTemplatesTableView; - IBOutlet NSTableView *_themesTableView; - IBOutlet NSTextField *_themesChatFontTextField; IBOutlet NSButton *_themesChatFontButton; IBOutlet NSColorWell *_themesChatTextColorWell; @@ -152,13 +137,10 @@ extern NSString * const WCIconDidChangeNotification; IBOutlet NSTextField *_networkConnectionTimeoutTextField; IBOutlet NSTextField *_networkReadTimeoutTextField; - IBOutlet NSPopUpButton *_networkCipherPopUpButton; IBOutlet NSButton *_networkCompressionButton; IBOutlet NSView *_bookmarksExportView; - - IBOutlet WCThemesPreferences *_themesPreferences; - + WITemplateBundleManager *_privateTemplateManager; WITemplateBundleManager *_publicTemplateManager; @@ -168,7 +150,6 @@ extern NSString * const WCIconDidChangeNotification; + (WCPreferences *)preferences; -- (BOOL)importThemeFromFile:(NSString *)path; - (BOOL)importTemplateFromFile:(NSString *)path; - (BOOL)importBookmarksFromFile:(NSString *)path; - (BOOL)importTrackerBookmarksFromFile:(NSString *)path; @@ -176,17 +157,6 @@ extern NSString * const WCIconDidChangeNotification; - (IBAction)changePreferences:(id)sender; -- (IBAction)customizeTheme:(id)sender; -- (IBAction)closeTheme:(id)sender; -- (IBAction)addTheme:(id)sender; -- (IBAction)cancelAddTheme:(id)sender; -- (IBAction)okAddTheme:(id)sender; -- (IBAction)editTheme:(id)sender; -- (IBAction)deleteTheme:(id)sender; -- (IBAction)duplicateTheme:(id)sender; -- (IBAction)exportTheme:(id)sender; -- (IBAction)importTheme:(id)sender; -- (IBAction)selectTheme:(id)sender; - (IBAction)changeTheme:(id)sender; - (IBAction)changeThemeFont:(id)sender; diff --git a/Sources/WCPreferences.m b/Sources/WCPreferences.m index e555dfe2..3a92eb24 100644 --- a/Sources/WCPreferences.m +++ b/Sources/WCPreferences.m @@ -27,7 +27,6 @@ */ #import "WCApplicationController.h" -#import "WCThemesPreferences.h" #import "WCChatHistory.h" #import "WCKeychain.h" #import "WCPreferences.h" @@ -61,22 +60,13 @@ - (void)_validate; - (void)_bookmarkDidChange:(NSDictionary *)bookmark; -- (void)_reloadThemes; - (void)_reloadTheme; - -- (void)_reloadTemplates; -- (void)_reloadTemplatesForMenu:(NSMenu *)menu; - - (void)_reloadChatLogsFolder; - - (void)_reloadEvents; - (void)_reloadEvent; - (void)_updateEventControls; - (void)_reloadDownloadFolder; -- (NSArray *)_themeNames; -- (void)_changeSelectedThemeToTheme:(NSDictionary *)theme; - - (void)_savePasswordForBookmark:(NSArray *)arguments; - (void)_savePasswordForTrackerBookmark:(NSArray *)arguments; @@ -86,19 +76,6 @@ - (void)_savePasswordForTrackerBookmark:(NSArray *)arguments; @implementation WCPreferences(Private) - (void)_validate { - - NSDictionary *theme; - NSInteger row; - - row = [self _selectedThemeRow]; - - if(row < 0) { - [_deleteThemeButton setEnabled:NO]; - } else { - theme = [[[WCSettings settings] objectForKey:WCThemes] objectAtIndex:row]; - - [_deleteThemeButton setEnabled:![theme objectForKey:WCThemesBuiltinName]]; - } [_deleteHighlightButton setEnabled:([_highlightsTableView selectedRow] >= 0)]; [_deleteIgnoreButton setEnabled:([_ignoresTableView selectedRow] >= 0)]; } @@ -118,13 +95,6 @@ - (void)_bookmarkDidChange:(NSDictionary *)bookmark { #pragma mark - - (void)_updateTheme:(NSMutableDictionary *)theme { -// [theme setObject:WIStringFromColor([_themesChatTextColorWell color]) forKey:WCThemesChatTextColor]; -// [theme setObject:WIStringFromColor([_themesChatBackgroundColorWell color]) forKey:WCThemesChatBackgroundColor]; -// [theme setObject:WIStringFromColor([_themesMessagesTextColorWell color]) forKey:WCThemesMessagesTextColor]; -// [theme setObject:WIStringFromColor([_themesMessagesBackgroundColorWell color]) forKey:WCThemesMessagesBackgroundColor]; -// [theme setObject:WIStringFromColor([_themesBoardsTextColorWell color]) forKey:WCThemesBoardsTextColor]; -// [theme setObject:WIStringFromColor([_themesBoardsBackgroundColorWell color]) forKey:WCThemesBoardsBackgroundColor]; - [theme setObject:WIStringFromColor([_themesChatEventsColorWell color]) forKey:WCThemesChatEventsColor]; [theme setObject:WIStringFromColor([_themesChatTimestampEveryLineColorWell color]) forKey:WCThemesChatTimestampEveryLineColor]; [theme setObject:WIStringFromColor([_themesChatURLsColorWell color]) forKey:WCThemesChatURLsColor]; @@ -145,9 +115,6 @@ - (void)_updateTheme:(NSMutableDictionary *)theme { [theme setBool:[_themesMonitorAlternateRowsButton state] forKey:WCThemesMonitorAlternateRows]; } -- (NSInteger)_selectedThemeRow { - return [_themesPopUpButton indexOfItem:[_themesPopUpButton selectedItem]]; -} - (NSDictionary *)_selectedTheme { NSString *identifier; @@ -160,135 +127,48 @@ - (NSDictionary *)_selectedTheme { } -- (void)_reloadThemes { - NSEnumerator *enumerator; - NSDictionary *theme; - NSMenuItem *item; - - [_themesPopUpButton removeAllItems]; - - enumerator = [[[WCSettings settings] objectForKey:WCThemes] objectEnumerator]; - - while((theme = [enumerator nextObject])) { - item = [NSMenuItem itemWithTitle:[theme objectForKey:WCThemesName]]; - [item setRepresentedObject:[theme objectForKey:WCThemesIdentifier]]; - [item setImage:[self imageForTheme:theme size:NSMakeSize(16.0, 12.0)]]; - [item setAction:@selector(selectTheme:)]; - [item setTarget:self]; - - [_themesPopUpButton addItem:item]; - } - - [_themesPopUpButton selectItemWithRepresentedObject:[[WCSettings settings] objectForKey:WCTheme]]; - [_themesPopUpButton addItem:[NSMenuItem separatorItem]]; - - [[_themesPopUpButton menu] addItemWithTitle:NSLS(@"Add New Theme...", @"Add Theme Menu Item Title") - action:@selector(addTheme:) - keyEquivalent:@""]; - - [[_themesPopUpButton menu] addItemWithTitle:NSLS(@"Edit Themes...", @"Edit Themes Menu Item Title") - action:@selector(editTheme:) - keyEquivalent:@""]; - - [_themesTableView reloadData]; -} - - (void)_reloadTheme { NSDictionary *theme; - NSInteger row; - - row = [[_themesPopUpButton menu] indexOfItem:[_themesPopUpButton selectedItem]]; - - if(row >= 0 && (NSUInteger) row < [[[WCSettings settings] objectForKey:WCThemes] count]) { - theme = [[[WCSettings settings] objectForKey:WCThemes] objectAtIndex:row]; - - [_themesChatFontTextField setStringValue:[WIFontFromString([theme objectForKey:WCThemesChatFont]) displayNameWithSize]]; - [_themesChatTextColorWell setColor:WIColorFromString([theme objectForKey:WCThemesChatTextColor])]; - [_themesChatBackgroundColorWell setColor:WIColorFromString([theme objectForKey:WCThemesChatBackgroundColor])]; - [_themesChatEventsColorWell setColor:WIColorFromString([theme objectForKey:WCThemesChatEventsColor])]; - [_themesChatTimestampEveryLineColorWell setColor:WIColorFromString([theme objectForKey:WCThemesChatTimestampEveryLineColor])]; - [_themesChatURLsColorWell setColor:WIColorFromString([theme objectForKey:WCThemesChatURLsColor])]; - - [_themesMessagesFontTextField setStringValue:[WIFontFromString([theme objectForKey:WCThemesMessagesFont]) displayNameWithSize]]; - [_themesMessagesTextColorWell setColor:WIColorFromString([theme objectForKey:WCThemesMessagesTextColor])]; - [_themesMessagesBackgroundColorWell setColor:WIColorFromString([theme objectForKey:WCThemesMessagesBackgroundColor])]; - - [_themesBoardsFontTextField setStringValue:[WIFontFromString([theme objectForKey:WCThemesBoardsFont]) displayNameWithSize]]; - [_themesBoardsTextColorWell setColor:WIColorFromString([theme objectForKey:WCThemesBoardsTextColor])]; - [_themesBoardsBackgroundColorWell setColor:WIColorFromString([theme objectForKey:WCThemesBoardsBackgroundColor])]; - [_themesShowSmileysButton setState:[theme boolForKey:WCThemesShowSmileys]]; - - [_themesChatTimestampEveryLineButton setState:[theme boolForKey:WCThemesChatTimestampEveryLine]]; - - [_themesUserListIconSizeMatrix selectCellWithTag:[theme integerForKey:WCThemesUserListIconSize]]; - [_themesUserListAlternateRowsButton setState:[theme boolForKey:WCThemesUserListAlternateRows]]; - - [_themesFileListIconSizeMatrix selectCellWithTag:[theme integerForKey:WCThemesFileListIconSize]]; - [_themesFileListAlternateRowsButton setState:[theme boolForKey:WCThemesFileListAlternateRows]]; - - [_themesTransferListShowProgressBarButton setState:[theme boolForKey:WCThemesTransferListShowProgressBar]]; - [_themesTransferListAlternateRowsButton setState:[theme boolForKey:WCThemesTransferListAlternateRows]]; - - [_themesTrackerListAlternateRowsButton setState:[theme boolForKey:WCThemesTrackerListAlternateRows]]; + theme = [[WCSettings settings] themeWithName:@"Wired"]; - [_themesMonitorIconSizeMatrix selectCellWithTag:[theme integerForKey:WCThemesMonitorIconSize]]; - [_themesMonitorAlternateRowsButton setState:[theme boolForKey:WCThemesMonitorAlternateRows]]; - - [self _reloadTemplates]; - } -} + [_themesChatFontTextField setStringValue:[WIFontFromString([theme objectForKey:WCThemesChatFont]) displayNameWithSize]]; + [_themesChatTextColorWell setColor:WIColorFromString([theme objectForKey:WCThemesChatTextColor])]; + [_themesChatBackgroundColorWell setColor:WIColorFromString([theme objectForKey:WCThemesChatBackgroundColor])]; + [_themesChatEventsColorWell setColor:WIColorFromString([theme objectForKey:WCThemesChatEventsColor])]; + [_themesChatTimestampEveryLineColorWell setColor:WIColorFromString([theme objectForKey:WCThemesChatTimestampEveryLineColor])]; + [_themesChatURLsColorWell setColor:WIColorFromString([theme objectForKey:WCThemesChatURLsColor])]; + [_themesMessagesFontTextField setStringValue:[WIFontFromString([theme objectForKey:WCThemesMessagesFont]) displayNameWithSize]]; + [_themesMessagesTextColorWell setColor:WIColorFromString([theme objectForKey:WCThemesMessagesTextColor])]; + [_themesMessagesBackgroundColorWell setColor:WIColorFromString([theme objectForKey:WCThemesMessagesBackgroundColor])]; + [_themesBoardsFontTextField setStringValue:[WIFontFromString([theme objectForKey:WCThemesBoardsFont]) displayNameWithSize]]; + [_themesBoardsTextColorWell setColor:WIColorFromString([theme objectForKey:WCThemesBoardsTextColor])]; + [_themesBoardsBackgroundColorWell setColor:WIColorFromString([theme objectForKey:WCThemesBoardsBackgroundColor])]; + [_themesShowSmileysButton setState:[theme boolForKey:WCThemesShowSmileys]]; - -- (void)_reloadTemplates { - [self _reloadTemplatesForMenu:[_themesTemplatesPopUpButton menu]]; + [_themesChatTimestampEveryLineButton setState:[theme boolForKey:WCThemesChatTimestampEveryLine]]; + + [_themesUserListIconSizeMatrix selectCellWithTag:[theme integerForKey:WCThemesUserListIconSize]]; + [_themesUserListAlternateRowsButton setState:[theme boolForKey:WCThemesUserListAlternateRows]]; + + [_themesFileListIconSizeMatrix selectCellWithTag:[theme integerForKey:WCThemesFileListIconSize]]; + [_themesFileListAlternateRowsButton setState:[theme boolForKey:WCThemesFileListAlternateRows]]; + + [_themesTransferListShowProgressBarButton setState:[theme boolForKey:WCThemesTransferListShowProgressBar]]; + [_themesTransferListAlternateRowsButton setState:[theme boolForKey:WCThemesTransferListAlternateRows]]; + + [_themesTrackerListAlternateRowsButton setState:[theme boolForKey:WCThemesTrackerListAlternateRows]]; + + [_themesMonitorIconSizeMatrix selectCellWithTag:[theme integerForKey:WCThemesMonitorIconSize]]; + [_themesMonitorAlternateRowsButton setState:[theme boolForKey:WCThemesMonitorAlternateRows]]; } -- (void)_reloadTemplatesForMenu:(NSMenu *)menu { - NSMutableArray *templates; - NSMenuItem *newItem; - NSString *bundleName; - NSDictionary *theme; - - if([self _selectedThemeRow] == -1) - return; - - theme = [[[WCSettings settings] objectForKey:WCThemes] objectAtIndex:[self _selectedThemeRow]]; - templates = [NSMutableArray arrayWithArray:[_privateTemplateManager templates]]; - - [templates addObjectsFromArray:[_publicTemplateManager templates]]; - [menu removeAllItems]; - - for(WITemplateBundle *template in templates) { - - bundleName = [template templateName]; - newItem = [menu addItemWithTitle:bundleName - action:@selector(selectThemeTemplate:) - keyEquivalent:@""]; - - [newItem setTarget:self]; - [newItem setRepresentedObject:template]; - - if([[theme objectForKey:WCThemesTemplate] isEqualTo:[template bundleIdentifier]]) { - [newItem setState:NSOnState]; - [_themesTemplatesPopUpButton selectItemWithRepresentedObject:template]; - } else - [newItem setState:NSOffState]; - } - - [menu addItem:[NSMenuItem separatorItem]]; - - // NSLS(@"Add New Theme...", @"Add Theme Menu Item Title") - - [menu addItemWithTitle:NSLS(@"Add New Template...", @"Add Template Menu Item Title") action:@selector(addThemeTemplate:) keyEquivalent:@""]; - [menu addItemWithTitle:NSLS(@"Manage Templates...", @"Add Templates Menu Item Title") action:@selector(manageThemeTemplates:) keyEquivalent:@""]; -} @@ -476,55 +356,6 @@ - (void)_reloadDownloadFolder { -#pragma mark - - -- (NSArray *)_themeNames { - NSEnumerator *enumerator; - NSDictionary *theme; - NSMutableArray *array; - - array = [NSMutableArray array]; - enumerator = [[[WCSettings settings] objectForKey:WCThemes] objectEnumerator]; - - while((theme = [enumerator nextObject])) - [array addObject:[theme objectForKey:WCThemesName]]; - - return array; -} - - - -- (void)_changeSelectedThemeToTheme:(NSDictionary *)theme { - [[WCSettings settings] replaceObjectAtIndex:0 withObject:theme inArrayForKey:WCThemes]; - - [self _reloadTheme]; - [self _reloadThemes]; - - [[NSNotificationCenter defaultCenter] postNotificationName:WCThemeDidChangeNotification object:theme]; -} - - -- (void)_changeBuiltinThemePanelDidEnd:(NSWindow *)sheet returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo { - NSMutableDictionary *newTheme; - NSDictionary *theme = contextInfo; - - if(returnCode == NSAlertDefaultReturn) { - newTheme = [[theme mutableCopy] autorelease]; - [newTheme setObject:[WCApplicationController copiedNameForName:[theme objectForKey:WCThemesName] existingNames:[self _themeNames]] - forKey:WCThemesName]; - [newTheme setObject:[NSString UUIDString] forKey:WCThemesIdentifier]; - [newTheme removeObjectForKey:WCThemesBuiltinName]; - - [[WCSettings settings] addObject:newTheme toArrayForKey:WCThemes]; - - [self _reloadThemes]; - } - - [theme release]; -} - - - #pragma mark - - (void)_savePasswordForBookmark:(NSArray *)arguments { @@ -586,11 +417,6 @@ - (id)init { _publicTemplateManager = [[WITemplateBundleManager templateManagerForPath:[WCApplicationSupportPath stringByStandardizingPath] isPrivate:NO] retain]; [self window]; - - [[NSNotificationCenter defaultCenter] - addObserver:self - selector:@selector(themesDidChange:) - name:WCThemesDidChangeNotification]; [[NSNotificationCenter defaultCenter] addObserver:self @@ -667,9 +493,9 @@ - (void)windowDidLoad { [_highlightsTableView registerForDraggedTypes:[NSArray arrayWithObject:WCIgnorePboardType]]; [_ignoresTableView registerForDraggedTypes:[NSArray arrayWithObject:WCIgnorePboardType]]; - [self _reloadThemes]; + //[self _reloadThemes]; [self _reloadTheme]; - [self _reloadTemplates]; + //[self _reloadTemplates]; [self _reloadChatLogsFolder]; [self _reloadEvents]; [self _reloadEvent]; @@ -708,7 +534,6 @@ - (void)windowDidLoad { [_networkConnectionTimeoutTextField setStringValue:[NSSWF:@"%d", [[WCSettings settings] intForKey:WCNetworkConnectionTimeout]]]; [_networkReadTimeoutTextField setStringValue:[NSSWF:@"%d", [[WCSettings settings] intForKey:WCNetworkReadTimeout]]]; - [_networkCipherPopUpButton selectItemWithTag:[[WCSettings settings] integerForKey:WCNetworkEncryptionCipher]]; [_networkCompressionButton setState:[[WCSettings settings] boolForKey:WCNetworkCompressionEnabled]]; [self _validate]; @@ -717,11 +542,6 @@ - (void)windowDidLoad { } -- (void)themesDidChange:(NSNotification *)notification { - [self _reloadThemes]; -} - - - (void)themeDidChange:(NSNotification *)notification { NSDictionary *theme; @@ -793,40 +613,6 @@ - (BOOL)validateMenuItem:(NSMenuItem *)item { #pragma mark - -- (BOOL)importThemeFromFile:(NSString *)path { - NSMutableDictionary *theme; - - [self showWindow:self]; - [self selectPreferenceView:_themesView]; - - theme = [NSMutableDictionary dictionaryWithContentsOfFile:path]; - - if(!theme || ![theme objectForKey:WCThemesName]) - return NO; - - [theme setObject:[NSString UUIDString] forKey:WCThemesIdentifier]; - - [[WCSettings settings] addObject:theme toArrayForKey:WCThemes]; - - [self _reloadThemes]; - - return YES; -} - - - -- (BOOL)importTemplateFromFile:(NSString *)path { - BOOL result; - - result = [_publicTemplateManager addTemplateAtPath:path]; - - if(result) [self _reloadTheme]; - - return result; -} - - - - (BOOL)importBookmarksFromFile:(NSString *)path { NSEnumerator *enumerator; NSArray *array; @@ -916,55 +702,6 @@ - (BOOL)importTrackerBookmarksFromFile:(NSString *)path { } - - - -#pragma mark - - -- (NSImage *)imageForTheme:(NSDictionary *)theme size:(NSSize)size { - NSMutableDictionary *attributes; - NSBezierPath *path; - NSImage *image; - NSSize largeSize; - - largeSize = NSMakeSize(64.0, 48.0); - image = [[NSImage alloc] initWithSize:largeSize]; - - [image lockFocus]; - - path = [NSBezierPath bezierPathWithRoundedRect:NSMakeRect(1.0, 1.0, largeSize.width - 2.0, largeSize.height - 2.0) cornerRadius:4.0]; - - [WIColorFromString([theme objectForKey:WCThemesChatBackgroundColor]) set]; - [path fill]; - - [[NSColor lightGrayColor] set]; - [path setLineWidth:2.0]; - [path stroke]; - - attributes = [NSMutableDictionary dictionaryWithObjectsAndKeys: - [NSFont fontWithName:[WIFontFromString([theme objectForKey:WCThemesChatFont]) fontName] size:12.0], - NSFontAttributeName, - WIColorFromString([theme objectForKey:WCThemesChatTextColor]), - NSForegroundColorAttributeName, - NULL]; - - [@"hello," drawAtPoint:NSMakePoint(8.0, largeSize.height - 19.0) withAttributes:attributes]; - [@"world!" drawAtPoint:NSMakePoint(8.0, largeSize.height - 31.0) withAttributes:attributes]; - - [attributes setObject:WIColorFromString([theme objectForKey:WCThemesChatEventsColor]) forKey:NSForegroundColorAttributeName]; - - [@"<< ! >>" drawAtPoint:NSMakePoint(8.0, largeSize.height - 43.0) withAttributes:attributes]; - - [image unlockFocus]; - - //[image setScalesWhenResized:YES]; - [image setSize:size]; - - return [image autorelease]; -} - - - #pragma mark - - (IBAction)changePreferences:(id)sender { @@ -1033,7 +770,6 @@ - (IBAction)changePreferences:(id)sender { - (IBAction)changeNetwork:(id)sender { [[WCSettings settings] setInteger:[_networkConnectionTimeoutTextField integerValue] forKey:WCNetworkConnectionTimeout]; [[WCSettings settings] setInteger:[_networkReadTimeoutTextField integerValue] forKey:WCNetworkReadTimeout]; - [[WCSettings settings] setInteger:[_networkCipherPopUpButton selectedTag] forKey:WCNetworkEncryptionCipher]; [[WCSettings settings] setBool:[_networkCompressionButton state] forKey:WCNetworkCompressionEnabled]; NSAlert *alert = [[NSAlert alloc] init]; @@ -1050,297 +786,6 @@ - (IBAction)changeNetwork:(id)sender { #pragma mark - -- (IBAction)customizeTheme:(id)sender { - [NSApp beginSheet:_themesWindow - modalForWindow:[self window] - modalDelegate:self - didEndSelector:nil - contextInfo:nil]; - -// NSDictionary *theme; -// NSAlert *alert; -// -// theme = [self _selectedTheme]; -// -// if([theme objectForKey:WCThemesBuiltinName]) { -// alert = [[NSAlert alloc] init]; -// [alert setMessageText:[NSSWF: -// NSLS(@"You cannot edit the built-in theme \u201c%@\u201d", @"Duplicate builtin theme dialog title (theme)"), -// [theme objectForKey:WCThemesName]]]; -// [alert setInformativeText:NSLS(@"Make a copy of it to edit it.", @"Duplicate builtin theme dialog description")]; -// [alert addButtonWithTitle:NSLS(@"Duplicate", @"Duplicate builtin theme dialog button title")]; -// [alert addButtonWithTitle:NSLS(@"Cancel", @"Duplicate builtin theme button title")]; -// -// [alert beginSheetModalForWindow:[self window] -// modalDelegate:self -// didEndSelector:@selector(customizeBuiltInAlertDidEnd:returnCode:contextInfo:) -// contextInfo:theme]; -// -// -// [alert release]; -// } else { -// [NSApp beginSheet:_themesWindow -// modalForWindow:[self window] -// modalDelegate:self -// didEndSelector:nil -// contextInfo:nil]; -// } -} - -/* -- (void)customizeBuiltInAlertDidEnd:(NSAlert *)sheet returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo { - NSMutableDictionary *newTheme; - NSString *newName; - NSDictionary *theme = contextInfo; - - [NSApp endSheet:[sheet window]]; - [[sheet window] orderOut:self]; - - if(returnCode == NSAlertDefaultReturn) { - newName = [WCApplicationController copiedNameForName:[theme objectForKey:WCThemesName] - existingNames:[self _themeNames]]; - - newTheme = [[theme mutableCopy] autorelease]; - [newTheme setObject:newName forKey:WCThemesName]; - [newTheme setObject:[NSString UUIDString] forKey:WCThemesIdentifier]; - [newTheme removeObjectForKey:WCThemesBuiltinName]; - - [[WCSettings settings] addObject:newTheme toArrayForKey:WCThemes]; - [self _reloadThemes]; - - [_themesPopUpButton selectItemWithTitle:newName]; - [[WCSettings settings] setObject:[newTheme objectForKey:WCThemesIdentifier] forKey:WCTheme]; - - [self _reloadTheme]; - - [NSApp beginSheet:_themesWindow - modalForWindow:[self window] - modalDelegate:self - didEndSelector:nil - contextInfo:nil]; - - } -} -*/ - -- (IBAction)closeTheme:(id)sender { - if([_themesWindow isVisible]) { - [NSApp endSheet:_themesWindow]; - [_themesWindow orderOut:self]; - } -} - - -- (IBAction)addTheme:(id)sender { - NSDictionary *theme; - NSString *name; - - [self _reloadThemes]; - - theme = [self _selectedTheme]; - - if(!theme) - return; - - name = [WCApplicationController copiedNameForName:[theme objectForKey:WCThemesName] - existingNames:[self _themeNames]]; - - [_addThemeNameTextField setStringValue:name]; - - [NSApp beginSheet:_addThemeWindow - modalForWindow:self.window - modalDelegate:self - didEndSelector:nil - contextInfo:nil]; -} - - -- (IBAction)cancelAddTheme:(id)sender { - [NSApp endSheet:_addThemeWindow]; - [_addThemeWindow orderOut:sender]; - - [_addThemeNameTextField setStringValue:@""]; -} - - -- (IBAction)okAddTheme:(id)sender { - NSMutableDictionary *theme; - NSString *name; - NSInteger row; - - name = [_addThemeNameTextField stringValue]; - - if([name length] > 0 && ![[self _themeNames] containsObject:name]) { - [NSApp endSheet:_addThemeWindow]; - [_addThemeWindow orderOut:sender]; - - row = [self _selectedThemeRow]; - - if(row < 0) - return; - - theme = [[[[[WCSettings settings] objectForKey:WCThemes] objectAtIndex:row] mutableCopy] autorelease]; - [theme setObject:[NSString UUIDString] forKey:WCThemesIdentifier]; - [theme removeObjectForKey:WCThemesBuiltinName]; - [theme setObject:name forKey:WCThemesName]; - - [[WCSettings settings] addObject:theme toArrayForKey:WCThemes]; - - [[NSNotificationCenter defaultCenter] postNotificationName:WCThemesDidChangeNotification - object:theme]; - } -} - - -- (IBAction)editTheme:(id)sender { - [self _reloadThemes]; - - [_themesPreferences open:sender]; -} - - -- (IBAction)deleteTheme:(id)sender { - NSAlert *alert; - NSString *name; - NSInteger row; - - row = [self _selectedThemeRow]; - - if(row < 0) - return; - - name = [[[[WCSettings settings] objectForKey:WCThemes] objectAtIndex:row] objectForKey:WCThemesName]; - - alert = [[NSAlert alloc] init]; - [alert setMessageText:[NSSWF:NSLS(@"Are you sure you want to delete \u201c%@\u201d?", @"Delete theme dialog title (theme)"), name]]; - [alert setInformativeText:NSLS(@"This cannot be undone.", @"Delete theme dialog description")]; - [alert addButtonWithTitle:NSLS(@"Delete", @"Delete theme dialog button title")]; - [alert addButtonWithTitle:NSLS(@"Cancel", @"Delete theme button title")]; - [alert beginSheetModalForWindow:[self window] - modalDelegate:self - didEndSelector:@selector(deleteThemeSheetDidEnd:returnCode:contextInfo:) - contextInfo:[[NSNumber alloc] initWithInteger:row]]; - [alert release]; -} - - - -- (void)deleteThemeSheetDidEnd:(NSWindow *)sheet returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo { - NSNumber *row = contextInfo; - NSString *identifier; - - if(returnCode == NSAlertDefaultReturn) { - identifier = [[[[WCSettings settings] objectForKey:WCThemes] objectAtIndex:[row unsignedIntegerValue]] - objectForKey:WCThemesIdentifier]; - - if([[[WCSettings settings] objectForKey:WCTheme] isEqualToString:identifier]) { - identifier = [[[[WCSettings settings] objectForKey:WCThemes] objectAtIndex:0] objectForKey:WCThemesIdentifier]; - - [[WCSettings settings] setObject:identifier forKey:WCTheme]; - } - - [[WCSettings settings] removeObjectAtIndex:[row unsignedIntegerValue] fromArrayForKey:WCThemes]; - - [self _reloadThemes]; - [self _reloadTheme]; - } - - [row release]; -} - - - -- (IBAction)duplicateTheme:(id)sender { - NSMutableDictionary *theme; - NSInteger row; - - row = [self _selectedThemeRow]; - - if(row < 0) - return; - - theme = [[[[[WCSettings settings] objectForKey:WCThemes] objectAtIndex:row] mutableCopy] autorelease]; - - [theme setObject:[NSString UUIDString] forKey:WCThemesIdentifier]; - [theme removeObjectForKey:WCThemesBuiltinName]; - [theme setObject:[WCApplicationController copiedNameForName:[theme objectForKey:WCThemesName] existingNames:[self _themeNames]] - forKey:WCThemesName]; - - [[WCSettings settings] addObject:theme toArrayForKey:WCThemes]; - - [self _reloadThemes]; -} - - - -- (IBAction)exportTheme:(id)sender { - __block NSSavePanel *savePanel; - __block NSMutableDictionary *theme; - NSInteger row; - - row = [self _selectedThemeRow]; - - if(row < 0) - return; - - theme = [[[[WCSettings settings] objectForKey:WCThemes] objectAtIndex:row] mutableCopy]; - [theme removeObjectForKey:WCThemesIdentifier]; - [theme removeObjectForKey:WCThemesBuiltinName]; - - savePanel = [NSSavePanel savePanel]; - [savePanel setAllowedFileTypes:[NSArray arrayWithObject:@"WiredTheme"]]; - [savePanel setCanSelectHiddenExtension:YES]; - [savePanel setNameFieldStringValue:[[theme objectForKey:WCThemesName] stringByAppendingPathExtension:@"WiredTheme"]]; - - [savePanel beginSheetModalForWindow:[self window] completionHandler:^(NSInteger result) { - if(result == NSModalResponseOK) - [theme writeToURL:[savePanel URL] atomically:YES]; - - [theme release]; - }]; -} - - - -- (IBAction)importTheme:(id)sender { - __block NSOpenPanel *openPanel; - - openPanel = [NSOpenPanel openPanel]; - [openPanel setCanChooseFiles:YES]; - [openPanel setCanChooseDirectories:NO]; - [openPanel setAllowedFileTypes:[NSArray arrayWithObject:@"WiredTheme"]]; - - [openPanel beginSheetModalForWindow:[self window] completionHandler:^(NSInteger result) { - if(result == NSModalResponseOK) - [self importThemeFromFile:[[openPanel URL] path]]; - }]; -} - - - - - -- (IBAction)selectTheme:(id)sender { - NSDictionary *theme; - NSInteger row; - - row = [[_themesPopUpButton menu] indexOfItem:[_themesPopUpButton selectedItem]]; - - if(row < 0 || [[[WCSettings settings] objectForKey:WCThemes] count] < (NSUInteger)row) - return; - - theme = [[[WCSettings settings] objectForKey:WCThemes] objectAtIndex:row]; - - [[WCSettings settings] setObject:[theme objectForKey:WCThemesIdentifier] forKey:WCTheme]; - - [self _reloadTemplates]; - - [[NSNotificationCenter defaultCenter] postNotificationName:WCThemeDidChangeNotification object:theme]; -} - - - - - (IBAction)changeTheme:(id)sender { NSMutableDictionary *theme; @@ -1434,116 +879,6 @@ - (void)setBoardsFont:(id)sender { - -#pragma mark - - -- (IBAction)selectThemeTemplate:(id)sender { - id value; - NSMutableDictionary *theme; - - value = [[sender representedObject] bundleIdentifier]; - - if(value && [value isKindOfClass:[NSString class]]) { - theme = [[[[[WCSettings settings] objectForKey:WCThemes] objectAtIndex:[self _selectedThemeRow]] mutableCopy] autorelease]; - - [theme setValue:value forKey:WCThemesTemplate]; - - [self _changeSelectedThemeToTheme:theme]; - } -} - - - -- (IBAction)addThemeTemplate:(id)sender { - __block NSOpenPanel *openPanel = [NSOpenPanel openPanel]; - [openPanel setAllowsMultipleSelection:NO]; - [openPanel setAllowedFileTypes:[NSArray arrayWithObject:@"WiredTemplate"]]; - - if([_themesTemplatesWindow isVisible]) - [self closeManageThemeTemplates:sender]; - - [openPanel beginSheetModalForWindow:[self window] completionHandler:^(NSInteger result) { - if(result == NSModalResponseOK) { - [_publicTemplateManager addTemplateAtPath:[[openPanel URL] path]]; - } - - [self _reloadTheme]; - }]; -} - - - - - - -- (IBAction)manageThemeTemplates:(id)sender { - [_themesTemplatesTableView reloadData]; - - [NSApp beginSheet:_themesTemplatesWindow - modalForWindow:[self window] - modalDelegate:self - didEndSelector:nil - contextInfo:nil]; -} - - - -- (IBAction)closeManageThemeTemplates:(id)sender { - [NSApp endSheet:_themesTemplatesWindow]; - [_themesTemplatesWindow orderOut:sender]; - - [self _reloadTheme]; -} - - - -- (IBAction)deleteThemeTemplate:(id)sender { - WITemplateBundle *selectedTemplate; - NSAlert *alert = [[[NSAlert alloc] init] autorelease]; - BOOL inUse; - - if([_themesTemplatesTableView selectedRow] != -1) { - - inUse = NO; - selectedTemplate = [[_publicTemplateManager templates] objectAtIndex:[_themesTemplatesTableView selectedRow]]; - - for(NSDictionary *theme in [[WCSettings settings] objectForKey:WCThemes]) { - if([[selectedTemplate bundleIdentifier] isEqualToString:[theme objectForKey:WCThemesTemplate]]) { - inUse = YES; - continue; - } - } - - if(!inUse) { - alert = [NSAlert alertWithMessageText:@"Deleting Template" - defaultButton:@"Delete" - alternateButton:@"Cancel" - otherButton:nil - informativeTextWithFormat:@"You will delete %@ template. This operation is not cancelable. Press Delete button to continue or Cancel to abort.", [selectedTemplate templateName]]; - - if([alert runModal] == NSAlertDefaultReturn) - if([_publicTemplateManager removeTemplate:selectedTemplate]) { - [_themesTemplatesTableView reloadData]; - [self _reloadTheme]; - } - - - } else { - alert = [NSAlert alertWithMessageText:@"Cannot Delete Used Template" - defaultButton:@"OK" - alternateButton:nil - otherButton:nil - informativeTextWithFormat:@"The template %@ you want to delete is currently used by some themes. You must be sure that this template is not used before deleting it.", [selectedTemplate templateName]]; - - [alert runModal]; - } - } -} - - - - - #pragma mark - - (IBAction)exportBookmarks:(id)sender { @@ -1861,7 +1196,7 @@ - (IBAction)changeEvent:(id)sender { [[WCSettings settings] setObject:events forKey:WCEvents]; [self _updateEventControls]; - + if(sender == _eventsSoundsPopUpButton || (sender == _eventsPlaySoundButton && [sender state] == NSOnState)) [NSSound playSoundNamed:[_eventsSoundsPopUpButton titleOfSelectedItem]]; } @@ -1964,8 +1299,6 @@ - (NSInteger)numberOfRowsInTableView:(NSTableView *)tableView { return [[[WCSettings settings] objectForKey:WCHighlights] count]; else if(tableView == _ignoresTableView) return [[[WCSettings settings] objectForKey:WCIgnores] count]; - else if (tableView == _themesTemplatesTableView) - return [[_publicTemplateManager templates] count]; return 0; } @@ -1989,12 +1322,6 @@ - (id)tableView:(NSTableView *)tableView objectValueForTableColumn:(NSTableColum if(column == _ignoresNickTableColumn) return [dictionary objectForKey:WCIgnoresNick]; } - else if (tableView == _themesTemplatesTableView) { - if([[column identifier] isEqualToString:@"Name"]) - return [[[_publicTemplateManager templates] objectAtIndex:row] templateName]; - else if([[column identifier] isEqualToString:@"Version"]) - return [[[_publicTemplateManager templates] objectAtIndex:row] templateVersion]; - } return NULL; } @@ -2002,9 +1329,6 @@ - (id)tableView:(NSTableView *)tableView objectValueForTableColumn:(NSTableColum - (BOOL)tableView:(NSTableView *)tableView shouldEditTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row { - if(tableView == _themesTemplatesTableView) - return NO; - return YES; } diff --git a/Sources/WCThemesPreferences.h b/Sources/WCThemesPreferences.h deleted file mode 100644 index 895b5fdc..00000000 --- a/Sources/WCThemesPreferences.h +++ /dev/null @@ -1,29 +0,0 @@ -// -// WCThemesPreferences.h -// WiredClient -// -// Created by nark on 14/10/13. -// -// - -#import -#import "WCPreferencesController.h" - - -extern NSString * const WCThemesDidChangeNotification; - - -@interface WCThemesPreferences : WCPreferencesController { - IBOutlet NSTableView *_themesTableView; - - IBOutlet NSButton *_renameButton; - IBOutlet NSButton *_deleteButton; -} - -@property (readonly) BOOL themeSelected; - -- (IBAction)duplicateTheme:(id)sender; -- (IBAction)renameTheme:(id)sender; -- (IBAction)deleteTheme:(id)sender; - -@end diff --git a/Sources/WCThemesPreferences.m b/Sources/WCThemesPreferences.m deleted file mode 100644 index cb6d70ad..00000000 --- a/Sources/WCThemesPreferences.m +++ /dev/null @@ -1,221 +0,0 @@ -// -// WCThemesPreferences.m -// WiredClient -// -// Created by nark on 14/10/13. -// -// - -#import "WCPreferences.h" -#import "WCThemesPreferences.h" -#import "WCApplicationController.h" -#import "WCSettings.h" - - -NSString * const WCThemesDidChangeNotification = @"WCThemesDidChangeNotification"; - - -@interface WCThemesPreferences (Private) - -- (NSArray *) _themeNames; -- (NSDictionary *) _selectedTheme; - -@end - - - - -@implementation WCThemesPreferences (Private) - -- (NSDictionary *)_selectedTheme { - NSDictionary *theme; - NSInteger row; - - row = [_themesTableView selectedRow]; - theme = nil; - - if(row < 0) - return nil; - - theme = [[[WCSettings settings] objectForKey:WCThemes] objectAtIndex:row]; - - return theme; -} - - -- (NSArray *)_themeNames { - NSEnumerator *enumerator; - NSDictionary *theme; - NSMutableArray *array; - - array = [NSMutableArray array]; - enumerator = [[[WCSettings settings] objectForKey:WCThemes] objectEnumerator]; - - while((theme = [enumerator nextObject])) - [array addObject:[theme objectForKey:WCThemesName]]; - - return array; -} - - -@end - - - - - -@implementation WCThemesPreferences - -#pragma mark - - -@dynamic themeSelected; - - - -#pragma mark - - -- (void)awakeFromNib { - - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(themesDidChange:) - name:WCThemesDidChangeNotification - object:nil]; - - [_themesTableView setDataSource:self]; - [_themesTableView setDelegate:self]; -} - - -- (void)themesDidChange:(NSNotification *)notification { - [_themesTableView reloadData]; -} - - - - - -#pragma mark - - -- (IBAction)open:(id)sender { - [super open:sender]; - - [_themesTableView reloadData]; -} - - -- (IBAction)duplicateTheme:(id)sender { - NSMutableDictionary *theme; - NSString *copiedName; - - theme = [[[self _selectedTheme] mutableCopy] autorelease]; - - if(!theme) return; - - copiedName = [WCApplicationController copiedNameForName:[theme objectForKey:WCThemesName] - existingNames:[self _themeNames]]; - - [theme setObject:[NSString UUIDString] forKey:WCThemesIdentifier]; - [theme removeObjectForKey:WCThemesBuiltinName]; - [theme setObject:copiedName forKey:WCThemesName]; - - [[WCSettings settings] addObject:theme toArrayForKey:WCThemes]; - - [[NSNotificationCenter defaultCenter] postNotificationName:WCThemesDidChangeNotification - object:theme]; -} - - -- (IBAction)renameTheme:(id)sender { - [_themesTableView editColumn:0 - row:[_themesTableView selectedRow] - withEvent:nil - select:YES]; -} - - -- (IBAction)deleteTheme:(id)sender { - NSDictionary *theme; - NSString *identifier; - - theme = [self _selectedTheme]; - identifier = [theme objectForKey:WCThemesIdentifier]; - - // can't remove buil-tin themes - if([theme objectForKey:WCThemesBuiltinName]) { - NSBeep(); - return; - } - - // if the removed theme is the selected, so select the first available theme - if([[[WCSettings settings] objectForKey:WCTheme] isEqualToString:identifier]) { - identifier = [[[[WCSettings settings] objectForKey:WCThemes] objectAtIndex:0] objectForKey:WCThemesIdentifier]; - - [[WCSettings settings] setObject:identifier forKey:WCTheme]; - [[NSNotificationCenter defaultCenter] postNotificationName:WCThemeDidChangeNotification - object:nil]; - } - - [[WCSettings settings] removeObject:theme fromArrayForKey:WCThemes]; - [[NSNotificationCenter defaultCenter] postNotificationName:WCThemesDidChangeNotification - object:nil]; -} - - - -#pragma mark - - -- (NSInteger)numberOfRowsInTableView:(NSTableView *)tableView { - return [[[WCSettings settings] objectForKey:WCThemes] count]; -} - -- (id)tableView:(NSTableView *)tableView objectValueForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row { - id value; - - value = [[[[WCSettings settings] objectForKey:WCThemes] objectAtIndex:row] objectForKey:WCThemesName]; - - return value; -} - -- (void)tableView:(NSTableView *)tableView setObjectValue:(id)object forTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row { - NSMutableDictionary *dictionary; - NSString *newName; - - newName = (NSString *)object; - - if([newName length] > 0 && ![[self _themeNames] containsObject:newName]) { - dictionary = [[[[[WCSettings settings] objectForKey:WCThemes] objectAtIndex:row] mutableCopy] autorelease]; - - [dictionary setObject:object forKey:WCThemesName]; - - [[WCSettings settings] replaceObjectAtIndex:row withObject:dictionary inArrayForKey:WCThemes]; - - [[NSNotificationCenter defaultCenter] postNotificationName:WCThemesDidChangeNotification - object:nil]; - } -} - -- (void)tableViewSelectionDidChange:(NSNotification *)notification { - NSDictionary *theme; - BOOL enabled = NO; - - [self willChangeValueForKey:@"themeSelected"]; - - theme = [self _selectedTheme]; - enabled = ([theme objectForKey:WCThemesBuiltinName] == nil); - - [_renameButton setEnabled:enabled]; - [_deleteButton setEnabled:enabled]; - - [self didChangeValueForKey:@"themeSelected"]; -} - - - - -#pragma mark - - -- (BOOL)themeSelected { - return ([self _selectedTheme] != nil); -} - -@end diff --git a/WiredClient.xcodeproj/project.pbxproj b/WiredClient.xcodeproj/project.pbxproj index 738abd8f..b93da46d 100644 --- a/WiredClient.xcodeproj/project.pbxproj +++ b/WiredClient.xcodeproj/project.pbxproj @@ -145,7 +145,6 @@ 4CE153271800D665004DA093 /* MMTabBarView.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 4CE152EE1800D5DA004DA093 /* MMTabBarView.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; 4CE153291800D665004DA093 /* WiredNetworking.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 4CE1530B1800D5E7004DA093 /* WiredNetworking.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; 4CE1532A1800D665004DA093 /* WiredAppKit.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 4CE1530D1800D5E7004DA093 /* WiredAppKit.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; - 4CEFF6BE180C3FA600AD7AD9 /* WCThemesPreferences.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CEFF6BD180C3FA600AD7AD9 /* WCThemesPreferences.m */; }; 4CEFF6D2180C3FF700AD7AD9 /* WCPreferencesController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CEFF6D1180C3FF700AD7AD9 /* WCPreferencesController.m */; }; 4CF094DB1559D8C1005D77BB /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 4CF094D91559D8C1005D77BB /* InfoPlist.strings */; }; 4CF094E51559D9AA005D77BB /* Neo.WiredTemplate in Copy Templates */ = {isa = PBXBuildFile; fileRef = 4CF094D41559D8C1005D77BB /* Neo.WiredTemplate */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; @@ -536,8 +535,6 @@ 4CD7B71E18157B9D00FA3846 /* WCBadgedTableCellView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WCBadgedTableCellView.m; sourceTree = ""; }; 4CDD88CC15F76F8000283005 /* wiredclientrnote.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = wiredclientrnote.html; sourceTree = ""; }; 4CE1533E1800D94A004DA093 /* Growl.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Growl.framework; path = vendor/Growl.framework; sourceTree = ""; }; - 4CEFF6BC180C3FA600AD7AD9 /* WCThemesPreferences.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WCThemesPreferences.h; path = Sources/WCThemesPreferences.h; sourceTree = ""; }; - 4CEFF6BD180C3FA600AD7AD9 /* WCThemesPreferences.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = WCThemesPreferences.m; path = Sources/WCThemesPreferences.m; sourceTree = ""; }; 4CEFF6D0180C3FF700AD7AD9 /* WCPreferencesController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WCPreferencesController.h; path = Sources/WCPreferencesController.h; sourceTree = ""; }; 4CEFF6D1180C3FF700AD7AD9 /* WCPreferencesController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = WCPreferencesController.m; path = Sources/WCPreferencesController.m; sourceTree = ""; }; 4CF094BD1559D67D005D77BB /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = System/Library/Frameworks/CoreData.framework; sourceTree = SDKROOT; }; @@ -1304,8 +1301,6 @@ A5A335E9071C484700A16E9A /* WCKeychain.h */, A5DC7EC1057AAEAD00736BBF /* WCPreferences.h */, A5DC7EC2057AAEAD00736BBF /* WCPreferences.m */, - 4CEFF6BC180C3FA600AD7AD9 /* WCThemesPreferences.h */, - 4CEFF6BD180C3FA600AD7AD9 /* WCThemesPreferences.m */, 4CEFF6D0180C3FF700AD7AD9 /* WCPreferencesController.h */, 4CEFF6D1180C3FF700AD7AD9 /* WCPreferencesController.m */, A5DC7FC9057AB0F200736BBF /* WCSettings.m */, @@ -1874,7 +1869,6 @@ A5F802980D8E378300A84685 /* WCMonitorCell.m in Sources */, A5AAD1480D86F15C0072FFA1 /* WCMonitorController.m in Sources */, A5DC7ECA057AAEAD00736BBF /* WCPreferences.m in Sources */, - 4CEFF6BE180C3FA600AD7AD9 /* WCThemesPreferences.m in Sources */, A5DC7F0A057AAF6C00736BBF /* WCPrivateChat.m in Sources */, A541A7830F115AC500D1EE94 /* WCPrivateChatController.m in Sources */, A55C7C0D0F2E500A006E8568 /* WCPrivateChatInvitation.m in Sources */, @@ -2344,7 +2338,7 @@ CODE_SIGN_IDENTITY = "Developer ID Application"; CODE_SIGN_STYLE = Manual; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 55; + CURRENT_PROJECT_VERSION = 57; DEVELOPMENT_TEAM = 7KTXA5Y36K; ENABLE_HARDENED_RUNTIME = YES; FRAMEWORK_SEARCH_PATHS = ( @@ -2598,7 +2592,7 @@ CODE_SIGN_IDENTITY = "Developer ID Application"; CODE_SIGN_STYLE = Manual; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 55; + CURRENT_PROJECT_VERSION = 57; DEVELOPMENT_TEAM = 7KTXA5Y36K; ENABLE_HARDENED_RUNTIME = YES; FRAMEWORK_SEARCH_PATHS = ( @@ -2700,7 +2694,7 @@ ALWAYS_SEARCH_USER_PATHS = NO; CODE_SIGN_ENTITLEMENTS = "Wired Client.entitlements"; CODE_SIGN_IDENTITY = "-"; - CURRENT_PROJECT_VERSION = 55; + CURRENT_PROJECT_VERSION = 57; ENABLE_HARDENED_RUNTIME = YES; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", diff --git a/WiredClient.xcodeproj/xcuserdata/nark.xcuserdatad/xcschemes/xcschememanagement.plist b/WiredClient.xcodeproj/xcuserdata/nark.xcuserdatad/xcschemes/xcschememanagement.plist index 5e7786a5..8672c56a 100644 --- a/WiredClient.xcodeproj/xcuserdata/nark.xcuserdatad/xcschemes/xcschememanagement.plist +++ b/WiredClient.xcodeproj/xcuserdata/nark.xcuserdatad/xcschemes/xcschememanagement.plist @@ -7,12 +7,12 @@ Localize Nibs.xcscheme_^#shared#^_ orderHint - 25 + 23 Localize Strings.xcscheme_^#shared#^_ orderHint - 23 + 25 Neo.xcscheme_^#shared#^_ diff --git a/de.lproj/Preferences.xib b/de.lproj/Preferences.xib index a72dd9e7..8cad1920 100755 --- a/de.lproj/Preferences.xib +++ b/de.lproj/Preferences.xib @@ -1,8 +1,8 @@ - + - + @@ -55,7 +55,6 @@ - @@ -77,7 +76,6 @@ - @@ -106,7 +104,7 @@ - + @@ -253,75 +251,13 @@ - -