adium 4070:2c20ac5527b8: Small code cleanups to AILogViewerWindo...
commits at adium.im
commits at adium.im
Tue Jul 26 16:26:31 UTC 2011
details: http://hg.adium.im/adium/rev/2c20ac5527b8
revision: 4070:2c20ac5527b8
branch: (none)
author: Patrick Steinhardt <steinhardt.p at me.com>
date: Tue Jul 26 18:26:23 2011 +0200
Small code cleanups to AILogViewerWindowController.
diffs (316 lines):
diff -r 1edb43ce5c01 -r 2c20ac5527b8 Source/AILogViewerWindowController.h
--- a/Source/AILogViewerWindowController.h Tue Jul 26 17:37:16 2011 +0300
+++ b/Source/AILogViewerWindowController.h Tue Jul 26 18:26:23 2011 +0200
@@ -15,35 +15,6 @@
*/
#import <Adium/AIWindowController.h>
-#import <AIUtilities/AIDividedAlternatingRowOutlineView.h>
-
- at class AIChatLog, AILoggerPlugin;
-
-#define LOG_SEARCH_STATUS_INTERVAL 20 //1/60ths of a second to wait before refreshing search status
-
-#define LOG_CONTENT_SEARCH_MAX_RESULTS 10000 //Max results allowed from a search
-#define LOG_RESULT_CLUMP_SIZE 10 //Number of logs to fetch at a time
-
-#define SEARCH_MENU AILocalizedString(@"Search Menu",nil)
-#define FROM AILocalizedString(@"From",nil)
-#define TO AILocalizedString(@"To",nil)
-
-#define ACCOUNT AILocalizedString(@"Account",nil)
-#define DESTINATION AILocalizedString(@"Destination",nil)
-
-#define DATE AILocalizedString(@"Date",nil)
-#define CONTENT AILocalizedString(@"Content",nil)
-#define DELETE AILocalizedString(@"Delete",nil)
-#define DELETEALL AILocalizedString(@"Delete All",nil)
-#define SEARCH AILocalizedString(@"Search",nil)
-
-#define KEY_LOG_VIEWER_EMOTICONS @"Log Viewer Emoticons"
-#define KEY_LOG_VIEWER_TIMESTAMPS @"Log Viewer Timestamps"
-#define KEY_LOG_VIEWER_SELECTED_COLUMN @"Log Viewer Selected Column Identifier"
-#define LOG_VIEWER_DID_CREATE_LOG_ARRAYS @"LogViewerDidCreateLogArrays"
-#define LOG_VIEWER_DID_UPDATE_LOG_ARRAYS @"LogViewerDidUpdateLogArrays"
-
-#define DATE_ITEM_IDENTIFIER @"date"
typedef enum {
LOG_SEARCH_FROM = 0,
@@ -65,34 +36,33 @@
AIDateTypeAfter
} AIDateType;
- at class AIListContact, AIChat, AIAccount, AIGradientView;
+ at class AIAccount, AIChatLog, AIDividedAlternatingRowOutlineView, AIGradientView, AIListContact, AILoggerPlugin;
@interface AILogViewerWindowController : AIWindowController <NSToolbarDelegate, NSOutlineViewDelegate, NSTableViewDelegate> {
- AILoggerPlugin *plugin;
+ AILoggerPlugin *plugin;
IBOutlet AIDividedAlternatingRowOutlineView *outlineView_contacts;
- IBOutlet NSSplitView *splitView_contacts;
- IBOutlet NSSplitView *splitView_logs;
- IBOutlet NSTableView *tableView_results;
- IBOutlet NSTextView *textView_content;
+ IBOutlet NSSplitView *splitView_contacts;
+ IBOutlet NSSplitView *splitView_logs;
+ IBOutlet NSTableView *tableView_results;
+ IBOutlet NSTextView *textView_content;
- IBOutlet NSView *view_SearchField;
- IBOutlet NSButton *button_deleteLogs;
+ IBOutlet NSView *view_SearchField;
- IBOutlet NSView *view_DatePicker;
- IBOutlet NSPopUpButton *popUp_dateFilter;
+ IBOutlet NSView *view_DatePicker;
+ IBOutlet NSPopUpButton *popUp_dateFilter;
IBOutlet NSTextField *textField_resultCount;
IBOutlet NSProgressIndicator *progressIndicator;
IBOutlet NSTextField *textField_progress;
- IBOutlet NSSearchField *searchField_logs;
+ IBOutlet NSSearchField *searchField_logs;
- IBOutlet NSDatePicker *datePicker;
+ IBOutlet NSDatePicker *datePicker;
- IBOutlet AIGradientView *view_FindNavigator;
- IBOutlet NSTextField *textField_findCount;
+ IBOutlet AIGradientView *view_FindNavigator;
+ IBOutlet NSTextField *textField_findCount;
IBOutlet NSSegmentedControl *segment_previousNext;
//Array of selected / displayed logs. (Locked access)
@@ -105,27 +75,25 @@
NSTableColumn *selectedColumn; //Selected/active sort column
//Search information
- NSInteger activeSearchID; //ID of the active search thread, all other threads should quit
- NSLock *searchingLock; //Locked when a search is in progress
+ NSInteger activeSearchID; //ID of the active search thread, all other threads should quit
BOOL searching; //YES if a search is in progress
NSString *activeSearchString; //Current search string
BOOL suppressSearchRequests;
BOOL isOpeningForContact;
- NSInteger indexingUpdatesReceivedWhileSearching; //Number of times indexing has updated during the current search
+ NSInteger indexingUpdatesReceivedWhileSearching; //Number of times indexing has updated during the current search
NSMutableArray *matches;
NSInteger currentMatch;
BOOL sortDirection; //Direction to sort
NSTimer *refreshResultsTimer;
- NSInteger searchIDToReattemptWhenComplete;
+ NSInteger searchIDToReattemptWhenComplete;
- NSString *filterForAccountName; //Account name to restrictively match content searches
NSMutableSet *contactIDsToFilter;
AIDateType filterDateType;
NSCalendarDate *filterDate;
- NSInteger firstDayOfWeek;
+ NSInteger firstDayOfWeek;
BOOL iCalFirstDayOfWeekDetermined;
NSMutableDictionary *logToGroupDict;
@@ -140,16 +108,10 @@
NSImage *adiumIcon;
NSImage *adiumIconHighlighted;
- NSMutableArray *fromArray; //Array of account names
- NSMutableArray *fromServiceArray; //Array of services for accounts
NSMutableArray *toArray; //Array of contacts
- NSMutableArray *toServiceArray; //Array of services for accounts
NSDateFormatter *headerDateFormatter; //Format for dates displayed in the content text view
- NSInteger sameSelection;
- BOOL useSame;
-
- NSInteger cachedSelectionIndex;
+ NSInteger cachedSelectionIndex;
BOOL deleteOccurred; // YES only if a delete occurs, allowing the table to preserve selection after a search begins
NSString *horizontalRule;
@@ -158,11 +120,11 @@
NSNumber *allContactsIdentifier;
//Old
- BOOL showEmoticons;
- BOOL showTimestamps;
+ BOOL showEmoticons;
+ BOOL showTimestamps;
- SKSearchRef currentSearch;
- NSLock *currentSearchLock;
+ SKSearchRef currentSearch;
+ NSLock *currentSearchLock;
NSInvocationOperation *displayOperation;
}
@@ -177,7 +139,6 @@
- (void)stopSearching;
- (void)displayLog:(AIChatLog *)log;
-- (void)installToolbar;
- (void)setSearchMode:(LogSearchMode)inMode;
- (void)setSearchString:(NSString *)inString;
diff -r 1edb43ce5c01 -r 2c20ac5527b8 Source/AILogViewerWindowController.m
--- a/Source/AILogViewerWindowController.m Tue Jul 26 17:37:16 2011 +0300
+++ b/Source/AILogViewerWindowController.m Tue Jul 26 18:26:23 2011 +0200
@@ -15,50 +15,55 @@
*/
#import "AILogViewerWindowController.h"
+
+#import "AIAccountController.h"
#import "AIChatLog.h"
+#import "AIChatController.h"
+#import "AIContactController.h"
+#import "AIGradientView.h"
#import "AILogFromGroup.h"
+#import "AILoggerPlugin.h"
#import "AILogToGroup.h"
-#import "AILoggerPlugin.h"
+#import "AILogDateFormatter.h"
+#import "AIXMLChatlogConverter.h"
#import "ESRankingCell.h"
-#import "AIXMLChatlogConverter.h"
-#import "AILogDateFormatter.h"
-#import "AIGradientView.h"
-
-#import <Adium/AIAccountControllerProtocol.h>
-#import <Adium/AIChatControllerProtocol.h>
-#import <Adium/AIContactControllerProtocol.h>
+
#import <Adium/AIContentControllerProtocol.h>
+#import <Adium/AIInterfaceControllerProtocol.h>
#import <Adium/AIMenuControllerProtocol.h>
+
#import <Adium/AIHTMLDecoder.h>
-#import <Adium/AIInterfaceControllerProtocol.h>
#import <Adium/AIListContact.h>
#import <Adium/AIMetaContact.h>
#import <Adium/AIService.h>
#import <Adium/AIServiceIcons.h>
#import <Adium/AIUserIcons.h>
-#import <Adium/KNShelfSplitView.h>
+
#import <AIUtilities/AIArrayAdditions.h>
#import <AIUtilities/AIAttributedStringAdditions.h>
#import <AIUtilities/AIDateFormatterAdditions.h>
#import <AIUtilities/AIFileManagerAdditions.h>
#import <AIUtilities/AIImageAdditions.h>
-#import <AIUtilities/AIImageTextCell.h>
#import <AIUtilities/AIOutlineViewAdditions.h>
-#import <AIUtilities/AISplitView.h>
#import <AIUtilities/AIStringAdditions.h>
#import <AIUtilities/AITableViewAdditions.h>
+
+#import <AIUtilities/AIImageTextCell.h>
#import <AIUtilities/AITextAttributes.h>
#import <AIUtilities/AIToolbarUtilities.h>
-#import <AIUtilities/AIApplicationAdditions.h>
#import <AIUtilities/AIDividedAlternatingRowOutlineView.h>
#import <libkern/OSAtomic.h>
+
#define KEY_LOG_VIEWER_WINDOW_FRAME @"Log Viewer Frame"
#define TOOLBAR_LOG_VIEWER @"Log Viewer Toolbar"
#define MAX_LOGS_TO_SORT_WHILE_SEARCHING 10000 //Max number of logs we will live sort while searching
-#define LOG_SEARCH_STATUS_INTERVAL 20 //1/60ths of a second to wait before refreshing search status
+#define LOG_SEARCH_STATUS_INTERVAL 20 //1/60ths of a second to wait before refreshing search status
+#define REFRESH_RESULTS_INTERVAL 1.0 //Interval between results refreshes while searching
+
+#define DATE_ITEM_IDENTIFIER @"date"
#define SEARCH_MENU AILocalizedString(@"Search Menu",nil)
#define FROM AILocalizedString(@"From",nil)
@@ -66,7 +71,6 @@
#define DATE AILocalizedString(@"Date",nil)
#define CONTENT AILocalizedString(@"Content",nil)
#define DELETE AILocalizedString(@"Delete",nil)
-#define DELETEALL AILocalizedString(@"Delete All",nil)
#define SEARCH AILocalizedString(@"Search",nil)
#define SEARCH_LOGS AILocalizedString(@"Search Logs",nil)
@@ -80,7 +84,9 @@
#define IMAGE_TIMESTAMPS_OFF @"timestamp32"
#define IMAGE_TIMESTAMPS_ON @"timestamp32_transparent"
-#define REFRESH_RESULTS_INTERVAL 1.0 //Interval between results refreshes while searching
+#define KEY_LOG_VIEWER_EMOTICONS @"Log Viewer Emoticons"
+#define KEY_LOG_VIEWER_TIMESTAMPS @"Log Viewer Timestamps"
+#define KEY_LOG_VIEWER_SELECTED_COLUMN @"Log Viewer Selected Column Identifier"
@interface AILogViewerWindowController ()
+ (NSOperationQueue *)sharedLogViewerQueue;
@@ -232,15 +238,10 @@
headerDateFormatter = [[NSDateFormatter localizedDateFormatter] retain];
currentSearchResults = [[NSMutableArray alloc] init];
- fromArray = [[NSMutableArray alloc] init];
- fromServiceArray = [[NSMutableArray alloc] init];
logFromGroupDict = [[NSMutableDictionary alloc] init];
toArray = [[NSMutableArray alloc] init];
- toServiceArray = [[NSMutableArray alloc] init];
logToGroupDict = [[NSMutableDictionary alloc] init];
resultsLock = [[NSRecursiveLock alloc] init];
- searchingLock = [[NSLock alloc] init];
- [searchingLock setName:@"LogSearchingLock"];
contactIDsToFilter = [[NSMutableSet alloc] initWithCapacity:1];
allContactsIdentifier = [[NSNumber numberWithInteger:-1] retain];
@@ -259,11 +260,7 @@
[filterDate release]; filterDate = nil;
[currentSearchLock release]; currentSearchLock = nil;
[resultsLock release];
- [searchingLock release];
- [fromArray release];
- [fromServiceArray release];
[toArray release];
- [toServiceArray release];
[currentSearchResults release];
[selectedColumn release];
[headerDateFormatter release];
@@ -275,8 +272,6 @@
[logFromGroupDict release]; logFromGroupDict = nil;
[logToGroupDict release]; logToGroupDict = nil;
- [filterForAccountName release]; filterForAccountName = nil;
-
[horizontalRule release]; horizontalRule = nil;
[adiumIcon release]; adiumIcon = nil;
@@ -499,9 +494,6 @@
//Rebuild the 'global' log indexes
[logFromGroupDict release]; logFromGroupDict = [[NSMutableDictionary alloc] init];
[toArray removeAllObjects]; //note: even if there are no logs, the name will remain [bug or feature?]
- [toServiceArray removeAllObjects];
- [fromArray removeAllObjects];
- [fromServiceArray removeAllObjects];
[self initLogFiltering];
@@ -997,14 +989,8 @@
if (firstIndex != NSNotFound) {
[tableView_results scrollRowToVisible:[[tableView_results selectedRowIndexes] firstIndex]];
} else {
- if (useSame == YES && sameSelection > 0) {
- [tableView_results selectRowIndexes:[NSIndexSet indexSetWithIndex:sameSelection] byExtendingSelection:NO];
- } else {
- [self selectFirstLog];
- }
+ [self selectFirstLog];
}
-
- useSame = NO;
}
- (void)selectFirstLog
More information about the commits
mailing list