mirror of
https://github.com/transmission/transmission
synced 2025-03-02 17:55:22 +00:00
Empty (and display) buffer right away when changing message level, and update the log a little more often.
This commit is contained in:
parent
d91cd60504
commit
6d15738403
4 changed files with 19 additions and 3 deletions
macosx
|
@ -5,7 +5,11 @@
|
|||
ACTIONS = {changeLevel = id; clearLog = id; };
|
||||
CLASS = MessageWindowController;
|
||||
LANGUAGE = ObjC;
|
||||
OUTLETS = {fLevelButton = NSPopUpButton; fTextView = NSTextView; };
|
||||
OUTLETS = {
|
||||
fLevelButton = NSPopUpButton;
|
||||
fScrollView = NSScrollView;
|
||||
fTextView = NSTextView;
|
||||
};
|
||||
SUPERCLASS = NSWindowController;
|
||||
}
|
||||
);
|
||||
|
|
BIN
macosx/English.lproj/MessageWindow.nib/keyedobjects.nib
generated
BIN
macosx/English.lproj/MessageWindow.nib/keyedobjects.nib
generated
Binary file not shown.
|
@ -27,6 +27,8 @@
|
|||
@interface MessageWindowController : NSWindowController
|
||||
{
|
||||
IBOutlet NSTextView * fTextView;
|
||||
IBOutlet NSScrollView * fScrollView;
|
||||
|
||||
IBOutlet NSPopUpButton * fLevelButton;
|
||||
|
||||
NSLock * fLock;
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
#define LEVEL_INFO 1
|
||||
#define LEVEL_DEBUG 2
|
||||
|
||||
#define UPDATE_SECONDS 0.5
|
||||
#define UPDATE_SECONDS 0.35
|
||||
|
||||
@interface MessageWindowController (Private)
|
||||
|
||||
|
@ -123,16 +123,24 @@ void addMessage(int level, const char * message)
|
|||
if ([fBufferArray count] == 0)
|
||||
return;
|
||||
|
||||
//keep scrolled to bottom if already at bottom or there is no scroll bar yet
|
||||
BOOL shouldScroll = NO;
|
||||
NSScroller * scroller = [fScrollView verticalScroller];
|
||||
if ([scroller floatValue] == 1.0 || [scroller isHidden] || [scroller knobProportion] == 1.0)
|
||||
shouldScroll = YES;
|
||||
|
||||
[fLock lock];
|
||||
|
||||
NSEnumerator * enumerator = [fBufferArray objectEnumerator];
|
||||
NSAttributedString * messageString;
|
||||
while ((messageString = [enumerator nextObject]))
|
||||
[[fTextView textStorage] appendAttributedString: messageString];
|
||||
|
||||
[fBufferArray removeAllObjects];
|
||||
|
||||
[fLock unlock];
|
||||
|
||||
if (shouldScroll)
|
||||
[fTextView scrollRangeToVisible: NSMakeRange([[fTextView string] length], 0)];
|
||||
}
|
||||
|
||||
- (void) changeLevel: (id) sender
|
||||
|
@ -145,6 +153,8 @@ void addMessage(int level, const char * message)
|
|||
else
|
||||
level = TR_MSG_ERR;
|
||||
|
||||
[self updateLog: nil];
|
||||
|
||||
tr_setMessageLevel(level);
|
||||
[[NSUserDefaults standardUserDefaults] setInteger: level forKey: @"MessageLevel"];
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue