Fix code_style.sh to include *.mm files after switch to Obj-C++ (#2846)

This commit is contained in:
Mike Gelfand 2022-03-31 00:52:23 +03:00 committed by GitHub
parent e4461c48d7
commit d943f069f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
32 changed files with 243 additions and 241 deletions

View File

@ -20,6 +20,7 @@ cfile_includes=(
'*.cc' '*.cc'
'*.h' '*.h'
'*.m' '*.m'
'*.mm'
) )
cfile_excludes=( cfile_excludes=(
'build/*' 'build/*'

View File

@ -36,11 +36,11 @@ AboutWindowController* fAboutBoxInstance = nil;
self.fVersionField.stringValue = @(LONG_VERSION_STRING); self.fVersionField.stringValue = @(LONG_VERSION_STRING);
self.fCopyrightField.stringValue = [NSBundle.mainBundle localizedStringForKey:@"NSHumanReadableCopyright" value:nil self.fCopyrightField.stringValue = [NSBundle.mainBundle localizedStringForKey:@"NSHumanReadableCopyright" value:nil
table:@"InfoPlist"]; table:@"InfoPlist"];
[self.fTextView.textStorage setAttributedString:[[NSAttributedString alloc] initWithPath:[NSBundle.mainBundle pathForResource:@"Credits" [self.fTextView.textStorage
ofType:@"rtf"] setAttributedString:[[NSAttributedString alloc] initWithPath:[NSBundle.mainBundle pathForResource:@"Credits" ofType:@"rtf"]
documentAttributes:nil]]; documentAttributes:nil]];
//size license button //size license button
CGFloat const oldButtonWidth = NSWidth(self.fLicenseButton.frame); CGFloat const oldButtonWidth = NSWidth(self.fLicenseButton.frame);

View File

@ -95,8 +95,8 @@
} }
[self.fPriorityPopUp selectItemAtIndex:priorityIndex]; [self.fPriorityPopUp selectItemAtIndex:priorityIndex];
self.fStartCheck.state = [NSUserDefaults.standardUserDefaults boolForKey:@"AutoStartDownload"] ? NSControlStateValueOn self.fStartCheck.state = [NSUserDefaults.standardUserDefaults boolForKey:@"AutoStartDownload"] ? NSControlStateValueOn :
: NSControlStateValueOff; NSControlStateValueOff;
if (self.fDestination) if (self.fDestination)
{ {

View File

@ -146,8 +146,8 @@
} }
[self.fPriorityPopUp selectItemAtIndex:priorityIndex]; [self.fPriorityPopUp selectItemAtIndex:priorityIndex];
self.fStartCheck.state = [NSUserDefaults.standardUserDefaults boolForKey:@"AutoStartDownload"] ? NSControlStateValueOn self.fStartCheck.state = [NSUserDefaults.standardUserDefaults boolForKey:@"AutoStartDownload"] ? NSControlStateValueOn :
: NSControlStateValueOff; NSControlStateValueOff;
self.fDeleteCheck.state = self.fDeleteTorrentEnableInitially ? NSControlStateValueOn : NSControlStateValueOff; self.fDeleteCheck.state = self.fDeleteTorrentEnableInitially ? NSControlStateValueOn : NSControlStateValueOff;
self.fDeleteCheck.enabled = self.fCanToggleDelete; self.fDeleteCheck.enabled = self.fCanToggleDelete;
@ -163,8 +163,9 @@
self.fLocationImageView.image = nil; self.fLocationImageView.image = nil;
} }
self.fTimer = [NSTimer scheduledTimerWithTimeInterval:UPDATE_SECONDS target:self selector:@selector(updateFiles) userInfo:nil self.fTimer = [NSTimer scheduledTimerWithTimeInterval:UPDATE_SECONDS target:self selector:@selector(updateFiles)
repeats:YES]; userInfo:nil
repeats:YES];
[self updateFiles]; [self updateFiles];
} }

View File

@ -70,11 +70,11 @@ BlocklistDownloader* fBLDownloader = nil;
fBLDownloader = nil; fBLDownloader = nil;
} }
- (void)URLSession:(NSURLSession *)session - (void)URLSession:(NSURLSession*)session
downloadTask:(NSURLSessionDownloadTask *)downloadTask downloadTask:(NSURLSessionDownloadTask*)downloadTask
didWriteData:(int64_t)bytesWritten didWriteData:(int64_t)bytesWritten
totalBytesWritten:(int64_t)totalBytesWritten totalBytesWritten:(int64_t)totalBytesWritten
totalBytesExpectedToWrite:(int64_t)totalBytesExpectedToWrite totalBytesExpectedToWrite:(int64_t)totalBytesExpectedToWrite
{ {
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
self.fState = BLOCKLIST_DL_DOWNLOADING; self.fState = BLOCKLIST_DL_DOWNLOADING;
@ -86,9 +86,7 @@ totalBytesExpectedToWrite:(int64_t)totalBytesExpectedToWrite
}); });
} }
- (void)URLSession:(NSURLSession *)session - (void)URLSession:(NSURLSession*)session task:(NSURLSessionTask*)task didCompleteWithError:(NSError*)error
task:(NSURLSessionTask *)task
didCompleteWithError:(NSError *)error
{ {
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
if (error) if (error)
@ -103,9 +101,9 @@ didCompleteWithError:(NSError *)error
}); });
} }
- (void)URLSession:(NSURLSession *)session - (void)URLSession:(NSURLSession*)session
downloadTask:(NSURLSessionDownloadTask *)downloadTask downloadTask:(NSURLSessionDownloadTask*)downloadTask
didFinishDownloadingToURL:(NSURL *)location didFinishDownloadingToURL:(NSURL*)location
{ {
self.fState = BLOCKLIST_DL_PROCESSING; self.fState = BLOCKLIST_DL_PROCESSING;
@ -130,14 +128,12 @@ didFinishDownloadingToURL:(NSURL *)location
} }
else else
{ {
[self decompressFrom:[NSURL fileURLWithPath:tempFile] [self decompressFrom:[NSURL fileURLWithPath:tempFile] to:[NSURL fileURLWithPath:blocklistFile] error:nil];
to:[NSURL fileURLWithPath:blocklistFile]
error:nil];
[NSFileManager.defaultManager removeItemAtPath:tempFile error:nil]; [NSFileManager.defaultManager removeItemAtPath:tempFile error:nil];
} }
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
const int count = tr_blocklistSetContent(((Controller*)NSApp.delegate).sessionHandle, blocklistFile.UTF8String); int const count = tr_blocklistSetContent(((Controller*)NSApp.delegate).sessionHandle, blocklistFile.UTF8String);
//delete downloaded file //delete downloaded file
[NSFileManager.defaultManager removeItemAtPath:blocklistFile error:nil]; [NSFileManager.defaultManager removeItemAtPath:blocklistFile error:nil];
@ -148,7 +144,8 @@ didFinishDownloadingToURL:(NSURL *)location
} }
else else
{ {
[self.viewController setFailed:NSLocalizedString(@"The specified blocklist file did not contain any valid rules.", "blocklist fail message")]; [self.viewController
setFailed:NSLocalizedString(@"The specified blocklist file did not contain any valid rules.", "blocklist fail message")];
} }
//update last updated date for schedule //update last updated date for schedule
@ -169,9 +166,8 @@ didFinishDownloadingToURL:(NSURL *)location
{ {
self.fState = BLOCKLIST_DL_START; self.fState = BLOCKLIST_DL_START;
self.fSession = [NSURLSession sessionWithConfiguration:NSURLSessionConfiguration.ephemeralSessionConfiguration self.fSession = [NSURLSession sessionWithConfiguration:NSURLSessionConfiguration.ephemeralSessionConfiguration delegate:self
delegate:self delegateQueue:nil];
delegateQueue:nil];
[BlocklistScheduler.scheduler cancelSchedule]; [BlocklistScheduler.scheduler cancelSchedule];
@ -218,11 +214,7 @@ didFinishDownloadingToURL:(NSURL *)location
NSTask* tarList = [[NSTask alloc] init]; NSTask* tarList = [[NSTask alloc] init];
tarList.launchPath = @"/usr/bin/tar"; tarList.launchPath = @"/usr/bin/tar";
tarList.arguments = @[ tarList.arguments = @[ @"--list", @"--file", file.path ];
@"--list",
@"--file",
file.path
];
NSPipe* pipe = [[NSPipe alloc] init]; NSPipe* pipe = [[NSPipe alloc] init];
tarList.standardOutput = pipe; tarList.standardOutput = pipe;
@ -242,8 +234,7 @@ didFinishDownloadingToURL:(NSURL *)location
NSData* data = [pipe.fileHandleForReading readDataToEndOfFile]; NSData* data = [pipe.fileHandleForReading readDataToEndOfFile];
NSString* output = [[NSString alloc] initWithData:data NSString* output = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
encoding:NSUTF8StringEncoding];
filename = [output componentsSeparatedByCharactersInSet:NSCharacterSet.newlineCharacterSet].firstObject; filename = [output componentsSeparatedByCharactersInSet:NSCharacterSet.newlineCharacterSet].firstObject;
} }
@ -263,12 +254,7 @@ didFinishDownloadingToURL:(NSURL *)location
NSTask* untar = [[NSTask alloc] init]; NSTask* untar = [[NSTask alloc] init];
untar.launchPath = @"/usr/bin/tar"; untar.launchPath = @"/usr/bin/tar";
untar.currentDirectoryPath = destinationDir.path; untar.currentDirectoryPath = destinationDir.path;
untar.arguments = @[ untar.arguments = @[ @"--extract", @"--file", file.path, filename ];
@"--extract",
@"--file",
file.path,
filename
];
@try @try
{ {
@ -298,10 +284,7 @@ didFinishDownloadingToURL:(NSURL *)location
NSTask* gunzip = [[NSTask alloc] init]; NSTask* gunzip = [[NSTask alloc] init];
gunzip.launchPath = @"/usr/bin/gunzip"; gunzip.launchPath = @"/usr/bin/gunzip";
gunzip.currentDirectoryPath = destinationDir.path; gunzip.currentDirectoryPath = destinationDir.path;
gunzip.arguments = @[ gunzip.arguments = @[ @"--keep", file.path ];
@"--keep",
file.path
];
@try @try
{ {
@ -313,7 +296,7 @@ didFinishDownloadingToURL:(NSURL *)location
return NO; return NO;
} }
} }
@catch (NSException *exception) @catch (NSException* exception)
{ {
return NO; return NO;
} }
@ -350,12 +333,11 @@ didFinishDownloadingToURL:(NSURL *)location
NSData* data = [pipe.fileHandleForReading readDataToEndOfFile]; NSData* data = [pipe.fileHandleForReading readDataToEndOfFile];
NSString* output = [[NSString alloc] initWithData:data NSString* output = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
encoding:NSUTF8StringEncoding];
filename = [output componentsSeparatedByCharactersInSet:NSCharacterSet.newlineCharacterSet].firstObject; filename = [output componentsSeparatedByCharactersInSet:NSCharacterSet.newlineCharacterSet].firstObject;
} }
@catch (NSException *exception) @catch (NSException* exception)
{ {
return NO; return NO;
} }
@ -371,10 +353,7 @@ didFinishDownloadingToURL:(NSURL *)location
NSTask* unzip = [[NSTask alloc] init]; NSTask* unzip = [[NSTask alloc] init];
unzip.launchPath = @"/usr/bin/unzip"; unzip.launchPath = @"/usr/bin/unzip";
unzip.currentDirectoryPath = destinationDir.path; unzip.currentDirectoryPath = destinationDir.path;
unzip.arguments = @[ unzip.arguments = @[ file.path, filename ];
file.path,
filename
];
@try @try
{ {
@ -386,7 +365,7 @@ didFinishDownloadingToURL:(NSURL *)location
return NO; return NO;
} }
} }
@catch (NSException *exception) @catch (NSException* exception)
{ {
return NO; return NO;
} }

View File

@ -13,7 +13,7 @@
@interface BlocklistScheduler () @interface BlocklistScheduler ()
@property (nonatomic) NSTimer* fTimer; @property(nonatomic) NSTimer* fTimer;
- (void)runUpdater; - (void)runUpdater;
@ -58,7 +58,7 @@ BlocklistScheduler* fScheduler = nil;
NSDate* useDate = lastUpdateDate ? [lastUpdateDate laterDate:closeDate] : closeDate; NSDate* useDate = lastUpdateDate ? [lastUpdateDate laterDate:closeDate] : closeDate;
self.fTimer = [[NSTimer alloc] initWithFireDate:useDate interval:0 target:self selector:@selector(runUpdater) userInfo:nil self.fTimer = [[NSTimer alloc] initWithFireDate:useDate interval:0 target:self selector:@selector(runUpdater) userInfo:nil
repeats:NO]; repeats:NO];
//current run loop usually means a second update won't work //current run loop usually means a second update won't work
NSRunLoop* loop = NSRunLoop.mainRunLoop; NSRunLoop* loop = NSRunLoop.mainRunLoop;

View File

@ -646,7 +646,7 @@ static void removeKeRangerRansomware()
{ {
NSLog(@"Could not IORegisterForSystemPower"); NSLog(@"Could not IORegisterForSystemPower");
} }
auto* const session = self.fLib; auto* const session = self.fLib;
//load previous transfers //load previous transfers
@ -655,7 +655,7 @@ static void removeKeRangerRansomware()
int n_torrents = 0; int n_torrents = 0;
tr_torrent** loaded_torrents = tr_sessionLoadTorrents(session, ctor, &n_torrents); tr_torrent** loaded_torrents = tr_sessionLoadTorrents(session, ctor, &n_torrents);
tr_ctorFree(ctor); tr_ctorFree(ctor);
// process the loaded torrents // process the loaded torrents
for (int i = 0; i < n_torrents; ++i) for (int i = 0; i < n_torrents; ++i)
{ {
@ -669,8 +669,7 @@ static void removeKeRangerRansomware()
[self.fTorrents addObject:torrent]; [self.fTorrents addObject:torrent];
self.fTorrentHashes[torrent.hashString] = torrent; self.fTorrentHashes[torrent.hashString] = torrent;
} }
//update previous transfers state by recreating a torrent from history //update previous transfers state by recreating a torrent from history
//and comparing to torrents already loaded via tr_sessionLoadTorrents //and comparing to torrents already loaded via tr_sessionLoadTorrents
NSString* historyFile = [self.fConfigDirectory stringByAppendingPathComponent:TRANSFER_PLIST]; NSString* historyFile = [self.fConfigDirectory stringByAppendingPathComponent:TRANSFER_PLIST];
@ -690,14 +689,15 @@ static void removeKeRangerRansomware()
NSMutableArray* waitToStartTorrents = [NSMutableArray NSMutableArray* waitToStartTorrents = [NSMutableArray
arrayWithCapacity:((history.count > 0 && !self.fPauseOnLaunch) ? history.count - 1 : 0)]; arrayWithCapacity:((history.count > 0 && !self.fPauseOnLaunch) ? history.count - 1 : 0)];
Torrent *t = [[Torrent alloc] init]; Torrent* t = [[Torrent alloc] init];
for (NSDictionary* historyItem in history) for (NSDictionary* historyItem in history)
{ {
NSString *hash = historyItem[@"TorrentHash"]; NSString* hash = historyItem[@"TorrentHash"];
if ([self.fTorrentHashes.allKeys containsObject:hash]) { if ([self.fTorrentHashes.allKeys containsObject:hash])
Torrent *torrent = self.fTorrentHashes[hash]; {
Torrent* torrent = self.fTorrentHashes[hash];
[t setResumeStatusForTorrent:torrent withHistory:historyItem forcePause:self.fPauseOnLaunch]; [t setResumeStatusForTorrent:torrent withHistory:historyItem forcePause:self.fPauseOnLaunch];
NSNumber* waitToStart; NSNumber* waitToStart;
if (!self.fPauseOnLaunch && (waitToStart = historyItem[@"WaitToStart"]) && waitToStart.boolValue) if (!self.fPauseOnLaunch && (waitToStart = historyItem[@"WaitToStart"]) && waitToStart.boolValue)
{ {
@ -758,8 +758,9 @@ static void removeKeRangerRansomware()
//timer to update the interface every second //timer to update the interface every second
[self updateUI]; [self updateUI];
self.fTimer = [NSTimer scheduledTimerWithTimeInterval:UPDATE_UI_SECONDS target:self selector:@selector(updateUI) userInfo:nil self.fTimer = [NSTimer scheduledTimerWithTimeInterval:UPDATE_UI_SECONDS target:self selector:@selector(updateUI)
repeats:YES]; userInfo:nil
repeats:YES];
[NSRunLoop.currentRunLoop addTimer:self.fTimer forMode:NSModalPanelRunLoopMode]; [NSRunLoop.currentRunLoop addTimer:self.fTimer forMode:NSModalPanelRunLoopMode];
[NSRunLoop.currentRunLoop addTimer:self.fTimer forMode:NSEventTrackingRunLoopMode]; [NSRunLoop.currentRunLoop addTimer:self.fTimer forMode:NSEventTrackingRunLoopMode];
@ -2137,7 +2138,8 @@ static void removeKeRangerRansomware()
[self.fInfoController updateInfoStats]; [self.fInfoController updateInfoStats];
[self.fInfoController.window orderFront:nil]; [self.fInfoController.window orderFront:nil];
if (self.fInfoController.canQuickLook && [QLPreviewPanel sharedPreviewPanelExists] && [QLPreviewPanel sharedPreviewPanel].visible) if (self.fInfoController.canQuickLook && [QLPreviewPanel sharedPreviewPanelExists] &&
[QLPreviewPanel sharedPreviewPanel].visible)
{ {
[[QLPreviewPanel sharedPreviewPanel] reloadData]; [[QLPreviewPanel sharedPreviewPanel] reloadData];
} }
@ -2303,13 +2305,13 @@ static void removeKeRangerRansomware()
{ {
__block TorrentGroup* parent = nil; __block TorrentGroup* parent = nil;
[self.fDisplayedTorrents enumerateObjectsWithOptions:NSEnumerationConcurrent [self.fDisplayedTorrents enumerateObjectsWithOptions:NSEnumerationConcurrent
usingBlock:^(TorrentGroup* group, NSUInteger idx, BOOL* stop) { usingBlock:^(TorrentGroup* group, NSUInteger idx, BOOL* stop) {
if ([group.torrents containsObject:torrent]) if ([group.torrents containsObject:torrent])
{ {
parent = group; parent = group;
*stop = YES; *stop = YES;
} }
}]; }];
if (parent) if (parent)
{ {
[[self.fTableView animator] expandItem:parent]; [[self.fTableView animator] expandItem:parent];
@ -2330,13 +2332,13 @@ static void removeKeRangerRansomware()
{ {
__block TorrentGroup* parent = nil; __block TorrentGroup* parent = nil;
[self.fDisplayedTorrents enumerateObjectsWithOptions:NSEnumerationConcurrent [self.fDisplayedTorrents enumerateObjectsWithOptions:NSEnumerationConcurrent
usingBlock:^(TorrentGroup* group, NSUInteger idx, BOOL* stop) { usingBlock:^(TorrentGroup* group, NSUInteger idx, BOOL* stop) {
if ([group.torrents containsObject:torrent]) if ([group.torrents containsObject:torrent])
{ {
parent = group; parent = group;
*stop = YES; *stop = YES;
} }
}]; }];
if (parent) if (parent)
{ {
[[self.fTableView animator] expandItem:parent]; [[self.fTableView animator] expandItem:parent];
@ -2736,7 +2738,7 @@ static void removeKeRangerRansomware()
} }
BOOL const filterTracker = searchStrings && [[self.fDefaults stringForKey:@"FilterSearchType"] isEqualToString:FILTER_TYPE_TRACKER]; BOOL const filterTracker = searchStrings && [[self.fDefaults stringForKey:@"FilterSearchType"] isEqualToString:FILTER_TYPE_TRACKER];
std::atomic<int32_t> active{0}, downloading{0}, seeding{0}, paused{0}, error{0}; std::atomic<int32_t> active{ 0 }, downloading{ 0 }, seeding{ 0 }, paused{ 0 }, error{ 0 };
// Pointers to be captured by Obj-C Block as const* // Pointers to be captured by Obj-C Block as const*
auto* activeRef = &active; auto* activeRef = &active;
auto* downloadingRef = &downloading; auto* downloadingRef = &downloading;
@ -2772,7 +2774,8 @@ static void removeKeRangerRansomware()
} }
} }
} }
else if (torrent.error) { else if (torrent.error)
{
std::atomic_fetch_add_explicit(errorRef, 1, std::memory_order_relaxed); std::atomic_fetch_add_explicit(errorRef, 1, std::memory_order_relaxed);
if (filterStatus && !filterError) if (filterStatus && !filterError)
{ {
@ -2847,9 +2850,7 @@ static void removeKeRangerRansomware()
//set button tooltips //set button tooltips
if (self.fFilterBar) if (self.fFilterBar)
{ {
[self.fFilterBar setCountAll:self.fTorrents.count [self.fFilterBar setCountAll:self.fTorrents.count active:active.load() downloading:downloading.load()
active:active.load()
downloading:downloading.load()
seeding:seeding.load() seeding:seeding.load()
paused:paused.load() paused:paused.load()
error:error.load()]; error:error.load()];
@ -2906,10 +2907,10 @@ static void removeKeRangerRansomware()
//for each of the torrents to add, find if it already exists (and keep track of those we've already added & those we need to remove) //for each of the torrents to add, find if it already exists (and keep track of those we've already added & those we need to remove)
[allTorrents enumerateObjectsWithOptions:0 usingBlock:^(id objAll, NSUInteger previousIndex, BOOL* stop) { [allTorrents enumerateObjectsWithOptions:0 usingBlock:^(id objAll, NSUInteger previousIndex, BOOL* stop) {
NSUInteger const currentIndex = [self.fDisplayedTorrents indexOfObjectAtIndexes:removePreviousIndexes NSUInteger const currentIndex = [self.fDisplayedTorrents indexOfObjectAtIndexes:removePreviousIndexes
options:NSEnumerationConcurrent options:NSEnumerationConcurrent
passingTest:^(id objDisplay, NSUInteger idx, BOOL* stop) { passingTest:^(id objDisplay, NSUInteger idx, BOOL* stop) {
return (BOOL)(objAll == objDisplay); return (BOOL)(objAll == objDisplay);
}]; }];
if (currentIndex == NSNotFound) if (currentIndex == NSNotFound)
{ {
[addIndexes addIndex:previousIndex]; [addIndexes addIndex:previousIndex];
@ -2946,12 +2947,12 @@ static void removeKeRangerRansomware()
[addIndexes removeIndexes:newAddIndexes]; [addIndexes removeIndexes:newAddIndexes];
[self.fDisplayedTorrents addObjectsFromArray:[allTorrents objectsAtIndexes:newAddIndexes]]; [self.fDisplayedTorrents addObjectsFromArray:[allTorrents objectsAtIndexes:newAddIndexes]];
[self.fTableView [self.fTableView insertItemsAtIndexes:[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(
insertItemsAtIndexes:[NSIndexSet indexSetWithIndexesInRange:NSMakeRange( self.fDisplayedTorrents.count -
self.fDisplayedTorrents.count - newAddIndexes.count, newAddIndexes.count,
newAddIndexes.count)] newAddIndexes.count)]
inParent:nil inParent:nil
withAnimation:NSTableViewAnimationSlideLeft]; withAnimation:NSTableViewAnimationSlideLeft];
} }
[self.fDisplayedTorrents addObjectsFromArray:[allTorrents objectsAtIndexes:addIndexes]]; [self.fDisplayedTorrents addObjectsFromArray:[allTorrents objectsAtIndexes:addIndexes]];
@ -3013,16 +3014,17 @@ static void removeKeRangerRansomware()
groupsByIndex[@(groupValue)] = newGroup; groupsByIndex[@(groupValue)] = newGroup;
[self.fDisplayedTorrents addObject:newGroup]; [self.fDisplayedTorrents addObject:newGroup];
[self.fTableView insertItemsAtIndexes:[NSIndexSet indexSetWithIndex:self.fDisplayedTorrents.count - 1] inParent:nil [self.fTableView insertItemsAtIndexes:[NSIndexSet indexSetWithIndex:self.fDisplayedTorrents.count - 1]
withAnimation:NSTableViewAnimationEffectFade]; inParent:nil
withAnimation:NSTableViewAnimationEffectFade];
[self.fTableView isGroupCollapsed:groupValue] ? [self.fTableView collapseItem:newGroup] : [self.fTableView isGroupCollapsed:groupValue] ? [self.fTableView collapseItem:newGroup] :
[self.fTableView expandItem:newGroup]; [self.fTableView expandItem:newGroup];
} }
else //if we haven't processed the other group yet, we have to make sure we don't flag it for removal the next time else //if we haven't processed the other group yet, we have to make sure we don't flag it for removal the next time
{ {
//ugggh, but shouldn't happen too often //ugggh, but shouldn't happen too often
if ([self.fDisplayedTorrents indexOfObject:newGroup if ([self.fDisplayedTorrents indexOfObject:newGroup
inRange:NSMakeRange(index + 1, originalGroupCount - (index + 1))] != NSNotFound) inRange:NSMakeRange(index + 1, originalGroupCount - (index + 1))] != NSNotFound)
{ {
markTorrentAsUsed = NO; markTorrentAsUsed = NO;
} }
@ -3032,7 +3034,7 @@ static void removeKeRangerRansomware()
[newGroup.torrents addObject:torrent]; [newGroup.torrents addObject:torrent];
[self.fTableView moveItemAtIndex:indexInGroup inParent:group toIndex:newGroup.torrents.count - 1 [self.fTableView moveItemAtIndex:indexInGroup inParent:group toIndex:newGroup.torrents.count - 1
inParent:newGroup]; inParent:newGroup];
--indexInGroup; --indexInGroup;
} }
@ -3063,7 +3065,7 @@ static void removeKeRangerRansomware()
[self.fDisplayedTorrents addObject:group]; [self.fDisplayedTorrents addObject:group];
[self.fTableView insertItemsAtIndexes:[NSIndexSet indexSetWithIndex:self.fDisplayedTorrents.count - 1] inParent:nil [self.fTableView insertItemsAtIndexes:[NSIndexSet indexSetWithIndex:self.fDisplayedTorrents.count - 1] inParent:nil
withAnimation:NSTableViewAnimationEffectFade]; withAnimation:NSTableViewAnimationEffectFade];
[self.fTableView isGroupCollapsed:groupValue] ? [self.fTableView collapseItem:group] : [self.fTableView expandItem:group]; [self.fTableView isGroupCollapsed:groupValue] ? [self.fTableView collapseItem:group] : [self.fTableView expandItem:group];
} }
@ -3071,7 +3073,7 @@ static void removeKeRangerRansomware()
BOOL const newTorrent = self.fAddingTransfers && [self.fAddingTransfers containsObject:torrent]; BOOL const newTorrent = self.fAddingTransfers && [self.fAddingTransfers containsObject:torrent];
[self.fTableView insertItemsAtIndexes:[NSIndexSet indexSetWithIndex:group.torrents.count - 1] inParent:group [self.fTableView insertItemsAtIndexes:[NSIndexSet indexSetWithIndex:group.torrents.count - 1] inParent:group
withAnimation:newTorrent ? NSTableViewAnimationSlideLeft : NSTableViewAnimationSlideDown]; withAnimation:newTorrent ? NSTableViewAnimationSlideLeft : NSTableViewAnimationSlideDown];
} }
//remove empty groups //remove empty groups
@ -3107,8 +3109,8 @@ static void removeKeRangerRansomware()
[self.fTableView beginUpdates]; [self.fTableView beginUpdates];
[self.fTableView removeItemsAtIndexes:[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, self.fDisplayedTorrents.count)] [self.fTableView removeItemsAtIndexes:[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, self.fDisplayedTorrents.count)]
inParent:nil inParent:nil
withAnimation:NSTableViewAnimationSlideDown]; withAnimation:NSTableViewAnimationSlideDown];
if (groupRows) if (groupRows)
{ {
@ -3304,9 +3306,10 @@ static void removeKeRangerRansomware()
} }
//check again in 10 seconds in case torrent file wasn't complete //check again in 10 seconds in case torrent file wasn't complete
self.fAutoImportTimer = [NSTimer scheduledTimerWithTimeInterval:10.0 target:self selector:@selector(checkAutoImportDirectory) self.fAutoImportTimer = [NSTimer scheduledTimerWithTimeInterval:10.0 target:self
userInfo:nil selector:@selector(checkAutoImportDirectory)
repeats:NO]; userInfo:nil
repeats:NO];
[self checkAutoImportDirectory]; [self checkAutoImportDirectory];
} }
@ -3794,7 +3797,8 @@ static void removeKeRangerRansomware()
self.fTableView.rowHeight = makeSmall ? ROW_HEIGHT_SMALL : ROW_HEIGHT_REGULAR; self.fTableView.rowHeight = makeSmall ? ROW_HEIGHT_SMALL : ROW_HEIGHT_REGULAR;
[self.fTableView beginUpdates]; [self.fTableView beginUpdates];
[self.fTableView noteHeightOfRowsWithIndexesChanged:[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, self.fTableView.numberOfRows)]]; [self.fTableView
noteHeightOfRowsWithIndexesChanged:[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, self.fTableView.numberOfRows)]];
[self.fTableView endUpdates]; [self.fTableView endUpdates];
//resize for larger min height if not set to auto size //resize for larger min height if not set to auto size
@ -3847,7 +3851,8 @@ static void removeKeRangerRansomware()
if (check) if (check)
{ {
//we can't call minSize, since it might be set to the current size (auto size) //we can't call minSize, since it might be set to the current size (auto size)
CGFloat const minHeight = self.minWindowContentSizeAllowed + (NSHeight(self.fWindow.frame) - NSHeight(self.fWindow.contentView.frame)); //contentView to window CGFloat const minHeight = self.minWindowContentSizeAllowed +
(NSHeight(self.fWindow.frame) - NSHeight(self.fWindow.contentView.frame)); //contentView to window
if (windowSize.height <= minHeight) if (windowSize.height <= minHeight)
{ {
@ -4810,8 +4815,7 @@ static void removeKeRangerRansomware()
if (action == @selector(toggleAvailabilityBar:)) if (action == @selector(toggleAvailabilityBar:))
{ {
menuItem.state = [self.fDefaults boolForKey:@"DisplayProgressBarAvailable"] ? NSControlStateValueOn menuItem.state = [self.fDefaults boolForKey:@"DisplayProgressBarAvailable"] ? NSControlStateValueOn : NSControlStateValueOff;
: NSControlStateValueOff;
return self.fWindow.visible; return self.fWindow.visible;
} }
@ -4819,7 +4823,7 @@ static void removeKeRangerRansomware()
if (action == @selector(showInfo:)) if (action == @selector(showInfo:))
{ {
NSString* title = self.fInfoController.window.visible ? NSLocalizedString(@"Hide Inspector", "View menu -> Inspector") : NSString* title = self.fInfoController.window.visible ? NSLocalizedString(@"Hide Inspector", "View menu -> Inspector") :
NSLocalizedString(@"Show Inspector", "View menu -> Inspector"); NSLocalizedString(@"Show Inspector", "View menu -> Inspector");
menuItem.title = title; menuItem.title = title;
return YES; return YES;
@ -4835,7 +4839,7 @@ static void removeKeRangerRansomware()
if (action == @selector(toggleStatusBar:)) if (action == @selector(toggleStatusBar:))
{ {
NSString* title = !self.fStatusBar ? NSLocalizedString(@"Show Status Bar", "View menu -> Status Bar") : NSString* title = !self.fStatusBar ? NSLocalizedString(@"Show Status Bar", "View menu -> Status Bar") :
NSLocalizedString(@"Hide Status Bar", "View menu -> Status Bar"); NSLocalizedString(@"Hide Status Bar", "View menu -> Status Bar");
menuItem.title = title; menuItem.title = title;
return self.fWindow.visible; return self.fWindow.visible;
@ -4845,7 +4849,7 @@ static void removeKeRangerRansomware()
if (action == @selector(toggleFilterBar:)) if (action == @selector(toggleFilterBar:))
{ {
NSString* title = !self.fFilterBar ? NSLocalizedString(@"Show Filter Bar", "View menu -> Filter Bar") : NSString* title = !self.fFilterBar ? NSLocalizedString(@"Show Filter Bar", "View menu -> Filter Bar") :
NSLocalizedString(@"Hide Filter Bar", "View menu -> Filter Bar"); NSLocalizedString(@"Hide Filter Bar", "View menu -> Filter Bar");
menuItem.title = title; menuItem.title = title;
return self.fWindow.visible; return self.fWindow.visible;
@ -5104,8 +5108,7 @@ static void removeKeRangerRansomware()
if (action == @selector(setSortReverse:)) if (action == @selector(setSortReverse:))
{ {
BOOL const isReverse = menuItem.tag == SORT_DESC_TAG; BOOL const isReverse = menuItem.tag == SORT_DESC_TAG;
menuItem.state = (isReverse == [self.fDefaults boolForKey:@"SortReverse"]) ? NSControlStateValueOn menuItem.state = (isReverse == [self.fDefaults boolForKey:@"SortReverse"]) ? NSControlStateValueOn : NSControlStateValueOff;
: NSControlStateValueOff;
return ![[self.fDefaults stringForKey:@"Sort"] isEqualToString:SORT_ORDER]; return ![[self.fDefaults stringForKey:@"Sort"] isEqualToString:SORT_ORDER];
} }
@ -5373,13 +5376,13 @@ static void removeKeRangerRansomware()
if (torrentStruct != NULL && (type != TR_RPC_TORRENT_ADDED && type != TR_RPC_SESSION_CHANGED && type != TR_RPC_SESSION_CLOSE)) if (torrentStruct != NULL && (type != TR_RPC_TORRENT_ADDED && type != TR_RPC_SESSION_CHANGED && type != TR_RPC_SESSION_CLOSE))
{ {
[self.fTorrents enumerateObjectsWithOptions:NSEnumerationConcurrent [self.fTorrents enumerateObjectsWithOptions:NSEnumerationConcurrent
usingBlock:^(Torrent* checkTorrent, NSUInteger idx, BOOL* stop) { usingBlock:^(Torrent* checkTorrent, NSUInteger idx, BOOL* stop) {
if (torrentStruct == checkTorrent.torrentStruct) if (torrentStruct == checkTorrent.torrentStruct)
{ {
torrent = checkTorrent; torrent = checkTorrent;
*stop = YES; *stop = YES;
} }
}]; }];
if (!torrent) if (!torrent)
{ {

View File

@ -192,14 +192,16 @@ NSMutableSet* creatorWindowControllerSet = nil;
[self updatePiecesField]; [self updatePiecesField];
[self.fPieceSizeStepper setIntValue:(int)log2((double)self.fInfo->pieceSize)]; [self.fPieceSizeStepper setIntValue:(int)log2((double)self.fInfo->pieceSize)];
self.fLocation = [[self.fDefaults URLForKey:@"CreatorLocationURL"] URLByAppendingPathComponent:[name stringByAppendingPathExtension:@"torrent"]]; self.fLocation = [[self.fDefaults URLForKey:@"CreatorLocationURL"]
URLByAppendingPathComponent:[name stringByAppendingPathExtension:@"torrent"]];
if (!self.fLocation) if (!self.fLocation)
{ {
//for 2.5 and earlier //for 2.5 and earlier
#warning we still store "CreatorLocation" in Defaults.plist, and not "CreatorLocationURL" #warning we still store "CreatorLocation" in Defaults.plist, and not "CreatorLocationURL"
NSString* location = [self.fDefaults stringForKey:@"CreatorLocation"]; NSString* location = [self.fDefaults stringForKey:@"CreatorLocation"];
self.fLocation = [[NSURL alloc] initFileURLWithPath:[location.stringByExpandingTildeInPath self.fLocation = [[NSURL alloc]
stringByAppendingPathComponent:[name stringByAppendingPathExtension:@"torrent"]]]; initFileURLWithPath:[location.stringByExpandingTildeInPath
stringByAppendingPathComponent:[name stringByAppendingPathExtension:@"torrent"]]];
} }
[self updateLocationField]; [self updateLocationField];
@ -360,7 +362,8 @@ NSMutableSet* creatorWindowControllerSet = nil;
- (IBAction)incrementOrDecrementPieceSize:(id)sender - (IBAction)incrementOrDecrementPieceSize:(id)sender
{ {
uint32_t pieceSize = (uint32_t)pow(2.0, [sender intValue]); uint32_t pieceSize = (uint32_t)pow(2.0, [sender intValue]);
if (tr_metaInfoBuilderSetPieceSize(self.fInfo, pieceSize)) { if (tr_metaInfoBuilderSetPieceSize(self.fInfo, pieceSize))
{
[self updatePiecesField]; [self updatePiecesField];
} }
} }
@ -513,13 +516,13 @@ NSMutableSet* creatorWindowControllerSet = nil;
if (self.fInfo->pieceCount == 1) if (self.fInfo->pieceCount == 1)
{ {
self.fPiecesField.stringValue = [NSString stringWithFormat:NSLocalizedString(@"1 piece, %@", "Create torrent -> info"), self.fPiecesField.stringValue = [NSString stringWithFormat:NSLocalizedString(@"1 piece, %@", "Create torrent -> info"),
[NSString stringForFileSize:self.fInfo->pieceSize]]; [NSString stringForFileSize:self.fInfo->pieceSize]];
} }
else else
{ {
self.fPiecesField.stringValue = [NSString stringWithFormat:NSLocalizedString(@"%d pieces, %@ each", "Create torrent -> info"), self.fPiecesField.stringValue = [NSString stringWithFormat:NSLocalizedString(@"%d pieces, %@ each", "Create torrent -> info"),
self.fInfo->pieceCount, self.fInfo->pieceCount,
[NSString stringForFileSize:self.fInfo->pieceSize]]; [NSString stringForFileSize:self.fInfo->pieceSize]];
} }
} }
@ -601,9 +604,10 @@ NSMutableSet* creatorWindowControllerSet = nil;
//store values //store values
[self.fDefaults setObject:self.fTrackers forKey:@"CreatorTrackers"]; [self.fDefaults setObject:self.fTrackers forKey:@"CreatorTrackers"];
[self.fDefaults setBool:self.fPrivateCheck.state == NSControlStateValueOn forKey:@"CreatorPrivate"]; [self.fDefaults setBool:self.fPrivateCheck.state == NSControlStateValueOn forKey:@"CreatorPrivate"];
[self.fDefaults setObject: [self.fSource stringValue] forKey: @"CreatorSource"]; [self.fDefaults setObject:[self.fSource stringValue] forKey:@"CreatorSource"];
[self.fDefaults setBool:self.fOpenCheck.state == NSControlStateValueOn forKey:@"CreatorOpen"]; [self.fDefaults setBool:self.fOpenCheck.state == NSControlStateValueOn forKey:@"CreatorOpen"];
self.fOpenWhenCreated = self.fOpenCheck.state == NSControlStateValueOn; //need this since the check box might not exist, and value in prefs might have changed from another creator window self.fOpenWhenCreated = self.fOpenCheck.state ==
NSControlStateValueOn; //need this since the check box might not exist, and value in prefs might have changed from another creator window
[self.fDefaults setURL:self.fLocation.URLByDeletingLastPathComponent forKey:@"CreatorLocationURL"]; [self.fDefaults setURL:self.fLocation.URLByDeletingLastPathComponent forKey:@"CreatorLocationURL"];
self.window.restorable = NO; self.window.restorable = NO;
@ -621,7 +625,8 @@ NSMutableSet* creatorWindowControllerSet = nil;
self.fSource.stringValue.UTF8String); self.fSource.stringValue.UTF8String);
tr_free(trackerInfo); tr_free(trackerInfo);
self.fTimer = [NSTimer scheduledTimerWithTimeInterval:0.1 target:self selector:@selector(checkProgress) userInfo:nil repeats:YES]; self.fTimer = [NSTimer scheduledTimerWithTimeInterval:0.1 target:self selector:@selector(checkProgress) userInfo:nil
repeats:YES];
} }
- (void)checkProgress - (void)checkProgress
@ -637,7 +642,10 @@ NSMutableSet* creatorWindowControllerSet = nil;
case TrMakemetaResult::OK: case TrMakemetaResult::OK:
if (self.fOpenWhenCreated) if (self.fOpenWhenCreated)
{ {
NSDictionary* dict = @{ @"File" : self.fLocation.path, @"Path" : self.fPath.URLByDeletingLastPathComponent.path }; NSDictionary* dict = @{
@"File" : self.fLocation.path,
@"Path" : self.fPath.URLByDeletingLastPathComponent.path
};
[NSNotificationCenter.defaultCenter postNotificationName:@"OpenCreatedTorrentFile" object:self userInfo:dict]; [NSNotificationCenter.defaultCenter postNotificationName:@"OpenCreatedTorrentFile" object:self userInfo:dict];
} }

View File

@ -94,9 +94,9 @@
NSRect const frame = self.frame; NSRect const frame = self.frame;
NSSize const imageSize = self.fBadge.size; NSSize const imageSize = self.fBadge.size;
[self.fBadge drawAtPoint:NSMakePoint((NSWidth(frame) - imageSize.width) * 0.5, (NSHeight(frame) - imageSize.height) * 0.5) [self.fBadge drawAtPoint:NSMakePoint((NSWidth(frame) - imageSize.width) * 0.5, (NSHeight(frame) - imageSize.height) * 0.5)
fromRect:NSZeroRect fromRect:NSZeroRect
operation:NSCompositingOperationSourceOver operation:NSCompositingOperationSourceOver
fraction:1.0]; fraction:1.0];
} }
} }

View File

@ -24,9 +24,7 @@
- (instancetype)initWithLib:(tr_session*)lib forWindow:(NSWindow*)window - (instancetype)initWithLib:(tr_session*)lib forWindow:(NSWindow*)window
{ {
if ((self = ([super initWithContentRect:window.frame if ((self = ([super initWithContentRect:window.frame styleMask:NSWindowStyleMaskBorderless backing:NSBackingStoreBuffered
styleMask:NSWindowStyleMaskBorderless
backing:NSBackingStoreBuffered
defer:NO]))) defer:NO])))
{ {
_fLib = lib; _fLib = lib;

View File

@ -78,7 +78,8 @@
{ {
if (!_iconInternal) if (!_iconInternal)
{ {
_iconInternal = [NSWorkspace.sharedWorkspace iconForFileType:_isFolder ? NSFileTypeForHFSTypeCode(kGenericFolderIcon) : _name.pathExtension]; _iconInternal = [NSWorkspace.sharedWorkspace
iconForFileType:_isFolder ? NSFileTypeForHFSTypeCode(kGenericFolderIcon) : _name.pathExtension];
} }
return _iconInternal; return _iconInternal;
} }

View File

@ -85,7 +85,8 @@
- (void)drawWithFrame:(NSRect)cellFrame inView:(NSView*)controlView - (void)drawWithFrame:(NSRect)cellFrame inView:(NSView*)controlView
{ {
//icon //icon
[self.image drawInRect:[self imageRectForBounds:cellFrame] fromRect:NSZeroRect operation:NSCompositingOperationSourceOver fraction:1.0 [self.image drawInRect:[self imageRectForBounds:cellFrame] fromRect:NSZeroRect operation:NSCompositingOperationSourceOver
fraction:1.0
respectFlipped:YES respectFlipped:YES
hints:nil]; hints:nil];

View File

@ -185,7 +185,7 @@ typedef NS_ENUM(unsigned int, filePriorityMenuTag) { //
NSRange const removeRange = NSMakeRange(currentIndex, self.fFileList.count - currentIndex); NSRange const removeRange = NSMakeRange(currentIndex, self.fFileList.count - currentIndex);
[self.fFileList removeObjectsInRange:removeRange]; [self.fFileList removeObjectsInRange:removeRange];
[self.fOutline removeItemsAtIndexes:[NSIndexSet indexSetWithIndexesInRange:removeRange] inParent:nil [self.fOutline removeItemsAtIndexes:[NSIndexSet indexSetWithIndexesInRange:removeRange] inParent:nil
withAnimation:NSTableViewAnimationSlideDown]; withAnimation:NSTableViewAnimationSlideDown];
} }
//add new items //add new items
@ -282,9 +282,8 @@ typedef NS_ENUM(unsigned int, filePriorityMenuTag) { //
indexSet = ((FileListNode*)item).indexes; indexSet = ((FileListNode*)item).indexes;
} }
[self.torrent setFileCheckState:[object intValue] != NSControlStateValueOff ? NSControlStateValueOn [self.torrent setFileCheckState:[object intValue] != NSControlStateValueOff ? NSControlStateValueOn : NSControlStateValueOff
: NSControlStateValueOff forIndexes:indexSet];
forIndexes:indexSet];
self.fOutline.needsDisplay = YES; self.fOutline.needsDisplay = YES;
[NSNotificationCenter.defaultCenter postNotificationName:@"UpdateUI" object:nil]; [NSNotificationCenter.defaultCenter postNotificationName:@"UpdateUI" object:nil];

View File

@ -156,7 +156,8 @@
imageSize.width, imageSize.width,
imageSize.height); imageSize.height);
[image drawInRect:imageRect fromRect:NSZeroRect operation:NSCompositingOperationSourceOver fraction:1.0 respectFlipped:YES [image drawInRect:imageRect fromRect:NSZeroRect operation:NSCompositingOperationSourceOver fraction:1.0
respectFlipped:YES
hints:nil]; hints:nil];
currentWidth += imageSize.width - IMAGE_OVERLAP; currentWidth += imageSize.width - IMAGE_OVERLAP;

View File

@ -385,9 +385,8 @@
if (action == @selector(setGroupFilter:)) if (action == @selector(setGroupFilter:))
{ {
menuItem.state = menuItem.tag == [NSUserDefaults.standardUserDefaults integerForKey:@"FilterGroup"] menuItem.state = menuItem.tag == [NSUserDefaults.standardUserDefaults integerForKey:@"FilterGroup"] ? NSControlStateValueOn :
? NSControlStateValueOn NSControlStateValueOff;
: NSControlStateValueOff;
return YES; return YES;
} }

View File

@ -237,13 +237,14 @@ GroupsController* fGroupsInstance = nil;
NSInteger const index = candidates.firstIndex; NSInteger const index = candidates.firstIndex;
[self.fGroups addObject:[NSMutableDictionary dictionaryWithObjectsAndKeys:@(index), [self.fGroups addObject:[NSMutableDictionary dictionaryWithObjectsAndKeys:@(index),
@"Index", @"Index",
[NSColor colorWithCalibratedRed:0.0 green:0.65 blue:1.0 [NSColor colorWithCalibratedRed:0.0 green:0.65
alpha:1.0], blue:1.0
@"Color", alpha:1.0],
@"", @"Color",
@"Name", @"",
nil]]; @"Name",
nil]];
[NSNotificationCenter.defaultCenter postNotificationName:@"UpdateGroups" object:self]; [NSNotificationCenter.defaultCenter postNotificationName:@"UpdateGroups" object:self];
[self saveGroups]; [self saveGroups];

View File

@ -122,9 +122,8 @@
NSInteger globalUseSpeedLimit = torrent.usesGlobalSpeedLimit ? NSControlStateValueOn : NSControlStateValueOff; NSInteger globalUseSpeedLimit = torrent.usesGlobalSpeedLimit ? NSControlStateValueOn : NSControlStateValueOff;
while ((torrent = [enumerator nextObject]) && while ((torrent = [enumerator nextObject]) &&
(uploadUseSpeedLimit != NSControlStateValueMixed || uploadSpeedLimit != INVALID || (uploadUseSpeedLimit != NSControlStateValueMixed || uploadSpeedLimit != INVALID || downloadUseSpeedLimit != NSControlStateValueMixed ||
downloadUseSpeedLimit != NSControlStateValueMixed || downloadSpeedLimit != INVALID || downloadSpeedLimit != INVALID || globalUseSpeedLimit != NSControlStateValueMixed))
globalUseSpeedLimit != NSControlStateValueMixed))
{ {
if (uploadUseSpeedLimit != NSControlStateValueMixed && if (uploadUseSpeedLimit != NSControlStateValueMixed &&
uploadUseSpeedLimit != ([torrent usesSpeedLimit:YES] ? NSControlStateValueOn : NSControlStateValueOff)) uploadUseSpeedLimit != ([torrent usesSpeedLimit:YES] ? NSControlStateValueOn : NSControlStateValueOff))
@ -195,8 +194,7 @@
NSInteger checkRatio = torrent.ratioSetting; NSInteger checkRatio = torrent.ratioSetting;
NSInteger checkIdle = torrent.idleSetting; NSInteger checkIdle = torrent.idleSetting;
NSInteger removeWhenFinishSeeding = torrent.removeWhenFinishSeeding ? NSControlStateValueOn NSInteger removeWhenFinishSeeding = torrent.removeWhenFinishSeeding ? NSControlStateValueOn : NSControlStateValueOff;
: NSControlStateValueOff;
CGFloat ratioLimit = torrent.ratioLimit; CGFloat ratioLimit = torrent.ratioLimit;
NSUInteger idleLimit = torrent.idleLimitMinutes; NSUInteger idleLimit = torrent.idleLimitMinutes;
@ -224,8 +222,7 @@
} }
if (removeWhenFinishSeeding != NSControlStateValueMixed && if (removeWhenFinishSeeding != NSControlStateValueMixed &&
removeWhenFinishSeeding != (torrent.removeWhenFinishSeeding ? NSControlStateValueOn removeWhenFinishSeeding != (torrent.removeWhenFinishSeeding ? NSControlStateValueOn : NSControlStateValueOff))
: NSControlStateValueOff))
{ {
removeWhenFinishSeeding = NSControlStateValueMixed; removeWhenFinishSeeding = NSControlStateValueMixed;
} }

View File

@ -15,7 +15,7 @@
#define ANIMATION_ID_KEY @"animationId" #define ANIMATION_ID_KEY @"animationId"
#define WEB_SEED_ANIMATION_ID @"webSeed" #define WEB_SEED_ANIMATION_ID @"webSeed"
@interface InfoPeersViewController () <CAAnimationDelegate> @interface InfoPeersViewController ()<CAAnimationDelegate>
@property(nonatomic, copy) NSArray* fTorrents; @property(nonatomic, copy) NSArray* fTorrents;
@ -71,7 +71,9 @@
[self.fWebSeedTable tableColumnWithIdentifier:@"DL From"].headerCell.stringValue = NSLocalizedString(@"DL", "inspector -> web seed table -> header"); [self.fWebSeedTable tableColumnWithIdentifier:@"DL From"].headerCell.stringValue = NSLocalizedString(@"DL", "inspector -> web seed table -> header");
//set table header tool tips //set table header tool tips
[self.fPeerTable tableColumnWithIdentifier:@"Encryption"].headerToolTip = NSLocalizedString(@"Encrypted Connection", "inspector -> peer table -> header tool tip"); [self.fPeerTable tableColumnWithIdentifier:@"Encryption"].headerToolTip = NSLocalizedString(
@"Encrypted Connection",
"inspector -> peer table -> header tool tip");
[self.fPeerTable tableColumnWithIdentifier:@"Progress"].headerToolTip = NSLocalizedString(@"Available", "inspector -> peer table -> header tool tip"); [self.fPeerTable tableColumnWithIdentifier:@"Progress"].headerToolTip = NSLocalizedString(@"Available", "inspector -> peer table -> header tool tip");
[self.fPeerTable tableColumnWithIdentifier:@"DL From"].headerToolTip = NSLocalizedString(@"Downloading From Peer", "inspector -> peer table -> header tool tip"); [self.fPeerTable tableColumnWithIdentifier:@"DL From"].headerToolTip = NSLocalizedString(@"Downloading From Peer", "inspector -> peer table -> header tool tip");
[self.fPeerTable tableColumnWithIdentifier:@"UL To"].headerToolTip = NSLocalizedString(@"Uploading To Peer", "inspector -> peer table -> header tool tip"); [self.fPeerTable tableColumnWithIdentifier:@"UL To"].headerToolTip = NSLocalizedString(@"Uploading To Peer", "inspector -> peer table -> header tool tip");

View File

@ -51,9 +51,9 @@
- (void)awakeFromNib - (void)awakeFromNib
{ {
[self.fTrackerAddRemoveControl.cell setToolTip:NSLocalizedString(@"Add a tracker", "Inspector view -> tracker buttons") [self.fTrackerAddRemoveControl.cell setToolTip:NSLocalizedString(@"Add a tracker", "Inspector view -> tracker buttons")
forSegment:TRACKER_ADD_TAG]; forSegment:TRACKER_ADD_TAG];
[self.fTrackerAddRemoveControl.cell setToolTip:NSLocalizedString(@"Remove selected trackers", "Inspector view -> tracker buttons") [self.fTrackerAddRemoveControl.cell setToolTip:NSLocalizedString(@"Remove selected trackers", "Inspector view -> tracker buttons")
forSegment:TRACKER_REMOVE_TAG]; forSegment:TRACKER_REMOVE_TAG];
CGFloat const height = [NSUserDefaults.standardUserDefaults floatForKey:@"InspectorContentHeightTracker"]; CGFloat const height = [NSUserDefaults.standardUserDefaults floatForKey:@"InspectorContentHeightTracker"];
if (height != 0.0) if (height != 0.0)
@ -319,7 +319,9 @@
self.fTrackerTable.trackers = self.fTrackers; self.fTrackerTable.trackers = self.fTrackers;
[self.fTrackerTable reloadData]; [self.fTrackerTable reloadData];
[self.fTrackerTable selectRowIndexes:[NSIndexSet indexSetWithIndex:self.fTrackers.count - 1] byExtendingSelection:NO]; [self.fTrackerTable selectRowIndexes:[NSIndexSet indexSetWithIndex:self.fTrackers.count - 1] byExtendingSelection:NO];
[self.fTrackerTable editColumn:[self.fTrackerTable columnWithIdentifier:@"Tracker"] row:self.fTrackers.count - 1 withEvent:nil select:YES]; [self.fTrackerTable editColumn:[self.fTrackerTable columnWithIdentifier:@"Tracker"] row:self.fTrackers.count - 1
withEvent:nil
select:YES];
} }
- (void)removeTrackers - (void)removeTrackers

View File

@ -100,24 +100,13 @@ typedef NS_ENUM(unsigned int, tabTag) {
[self.fTabs.cell setToolTip:NSLocalizedString(@"Files", "Inspector -> tab") forSegment:TAB_FILE_TAG]; [self.fTabs.cell setToolTip:NSLocalizedString(@"Files", "Inspector -> tab") forSegment:TAB_FILE_TAG];
[self.fTabs.cell setToolTip:NSLocalizedString(@"Options", "Inspector -> tab") forSegment:TAB_OPTIONS_TAG]; [self.fTabs.cell setToolTip:NSLocalizedString(@"Options", "Inspector -> tab") forSegment:TAB_OPTIONS_TAG];
[self.fTabs setImage:[NSImage systemSymbol:@"info.circle" [self.fTabs setImage:[NSImage systemSymbol:@"info.circle" withFallback:@"InfoGeneral"] forSegment:TAB_GENERAL_TAG];
withFallback:@"InfoGeneral"] [self.fTabs setImage:[NSImage systemSymbol:@"square.grid.3x3.fill.square" withFallback:@"InfoActivity"] forSegment:TAB_ACTIVITY_TAG];
forSegment:TAB_GENERAL_TAG]; [self.fTabs setImage:[NSImage systemSymbol:@"antenna.radiowaves.left.and.right" withFallback:@"InfoTracker"]
[self.fTabs setImage:[NSImage systemSymbol:@"square.grid.3x3.fill.square" forSegment:TAB_TRACKERS_TAG];
withFallback:@"InfoActivity"] [self.fTabs setImage:[NSImage systemSymbol:@"person.2" withFallback:@"InfoPeers"] forSegment:TAB_PEERS_TAG];
forSegment:TAB_ACTIVITY_TAG]; [self.fTabs setImage:[NSImage systemSymbol:@"doc.on.doc" withFallback:@"InfoFiles"] forSegment:TAB_FILE_TAG];
[self.fTabs setImage:[NSImage systemSymbol:@"antenna.radiowaves.left.and.right" [self.fTabs setImage:[NSImage systemSymbol:@"gearshape" withFallback:@"InfoOptions"] forSegment:TAB_OPTIONS_TAG];
withFallback:@"InfoTracker"]
forSegment:TAB_TRACKERS_TAG];
[self.fTabs setImage:[NSImage systemSymbol:@"person.2"
withFallback:@"InfoPeers"]
forSegment:TAB_PEERS_TAG];
[self.fTabs setImage:[NSImage systemSymbol:@"doc.on.doc"
withFallback:@"InfoFiles"]
forSegment:TAB_FILE_TAG];
[self.fTabs setImage:[NSImage systemSymbol:@"gearshape"
withFallback:@"InfoOptions"]
forSegment:TAB_OPTIONS_TAG];
//set selected tab //set selected tab
self.fCurrentTabTag = INVALID; self.fCurrentTabTag = INVALID;
@ -446,7 +435,7 @@ typedef NS_ENUM(unsigned int, tabTag) {
self.fImageView.image = [NSImage imageNamed:NSImageNameMultipleDocuments]; self.fImageView.image = [NSImage imageNamed:NSImageNameMultipleDocuments];
self.fNameField.stringValue = [NSString stringWithFormat:NSLocalizedString(@"%@ Torrents Selected", "Inspector -> selected torrents"), self.fNameField.stringValue = [NSString stringWithFormat:NSLocalizedString(@"%@ Torrents Selected", "Inspector -> selected torrents"),
[NSString formattedUInteger:numberSelected]]; [NSString formattedUInteger:numberSelected]];
self.fNameField.hidden = NO; self.fNameField.hidden = NO;
uint64_t size = 0; uint64_t size = 0;

View File

@ -105,8 +105,9 @@
filterButtonFrame.origin.x -= NSWidth(clearButtonFrame) - oldClearButtonWidth; filterButtonFrame.origin.x -= NSWidth(clearButtonFrame) - oldClearButtonWidth;
self.fFilterField.frame = filterButtonFrame; self.fFilterField.frame = filterButtonFrame;
self.fAttributes = [[[self.fMessageTable tableColumnWithIdentifier:@"Message"].dataCell attributedStringValue] attributesAtIndex:0 self.fAttributes = [[[self.fMessageTable tableColumnWithIdentifier:@"Message"].dataCell attributedStringValue]
effectiveRange:NULL]; attributesAtIndex:0
effectiveRange:NULL];
//select proper level in popup button //select proper level in popup button
switch ([NSUserDefaults.standardUserDefaults integerForKey:@"MessageLevel"]) switch ([NSUserDefaults.standardUserDefaults integerForKey:@"MessageLevel"])
@ -147,8 +148,9 @@
{ {
if (!self.fTimer) if (!self.fTimer)
{ {
self.fTimer = [NSTimer scheduledTimerWithTimeInterval:UPDATE_SECONDS target:self selector:@selector(updateLog:) userInfo:nil self.fTimer = [NSTimer scheduledTimerWithTimeInterval:UPDATE_SECONDS target:self selector:@selector(updateLog:)
repeats:YES]; userInfo:nil
repeats:YES];
[self updateLog:nil]; [self updateLog:nil];
} }
} }
@ -173,7 +175,7 @@
{ {
[self.fTimer invalidate]; [self.fTimer invalidate];
self.fTimer = [NSTimer scheduledTimerWithTimeInterval:UPDATE_SECONDS target:self selector:@selector(updateLog:) userInfo:nil self.fTimer = [NSTimer scheduledTimerWithTimeInterval:UPDATE_SECONDS target:self selector:@selector(updateLog:) userInfo:nil
repeats:YES]; repeats:YES];
[self updateLog:nil]; [self updateLog:nil];
} }
@ -406,7 +408,7 @@
[self.fMessageTable beginUpdates]; [self.fMessageTable beginUpdates];
[self.fMessageTable removeRowsAtIndexes:[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, self.fDisplayedMessages.count)] [self.fMessageTable removeRowsAtIndexes:[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, self.fDisplayedMessages.count)]
withAnimation:NSTableViewAnimationSlideLeft]; withAnimation:NSTableViewAnimationSlideLeft];
[self.fDisplayedMessages removeAllObjects]; [self.fDisplayedMessages removeAllObjects];
@ -460,7 +462,8 @@
- (void)resizeColumn - (void)resizeColumn
{ {
[self.fMessageTable noteHeightOfRowsWithIndexesChanged:[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, self.fMessageTable.numberOfRows)]]; [self.fMessageTable
noteHeightOfRowsWithIndexesChanged:[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, self.fMessageTable.numberOfRows)]];
} }
- (BOOL)shouldIncludeMessageForFilter:(NSString*)filterString message:(NSDictionary*)message - (BOOL)shouldIncludeMessageForFilter:(NSString*)filterString message:(NSDictionary*)message
@ -481,10 +484,10 @@
NSString* filterString = self.fFilterField.stringValue; NSString* filterString = self.fFilterField.stringValue;
NSIndexSet* indexes = [self.fMessages indexesOfObjectsWithOptions:NSEnumerationConcurrent NSIndexSet* indexes = [self.fMessages indexesOfObjectsWithOptions:NSEnumerationConcurrent
passingTest:^BOOL(id message, NSUInteger idx, BOOL* stop) { passingTest:^BOOL(id message, NSUInteger idx, BOOL* stop) {
return [((NSDictionary*)message)[@"Level"] integerValue] <= level && return [((NSDictionary*)message)[@"Level"] integerValue] <= level &&
[self shouldIncludeMessageForFilter:filterString message:message]; [self shouldIncludeMessageForFilter:filterString message:message];
}]; }];
NSArray* tempMessages = [[self.fMessages objectsAtIndexes:indexes] sortedArrayUsingDescriptors:self.fMessageTable.sortDescriptors]; NSArray* tempMessages = [[self.fMessages objectsAtIndexes:indexes] sortedArrayUsingDescriptors:self.fMessageTable.sortDescriptors];
@ -524,7 +527,7 @@
NSRange const removeRange = NSMakeRange(currentIndex, self.fDisplayedMessages.count - currentIndex); NSRange const removeRange = NSMakeRange(currentIndex, self.fDisplayedMessages.count - currentIndex);
[self.fDisplayedMessages removeObjectsInRange:removeRange]; [self.fDisplayedMessages removeObjectsInRange:removeRange];
[self.fMessageTable removeRowsAtIndexes:[NSIndexSet indexSetWithIndexesInRange:removeRange] [self.fMessageTable removeRowsAtIndexes:[NSIndexSet indexSetWithIndexesInRange:removeRange]
withAnimation:NSTableViewAnimationSlideDown]; withAnimation:NSTableViewAnimationSlideDown];
} }
//add new items //add new items

View File

@ -59,7 +59,8 @@
imageSize.width, imageSize.width,
imageSize.height); imageSize.height);
[checkImage drawInRect:rect fromRect:NSZeroRect operation:NSCompositingOperationSourceOver fraction:1.0 respectFlipped:YES [checkImage drawInRect:rect fromRect:NSZeroRect operation:NSCompositingOperationSourceOver fraction:1.0
respectFlipped:YES
hints:nil]; hints:nil];
} }
} }

View File

@ -34,8 +34,8 @@
_fStatus = PORT_STATUS_CHECKING; _fStatus = PORT_STATUS_CHECKING;
_fTimer = [NSTimer scheduledTimerWithTimeInterval:CHECK_FIRE target:self selector:@selector(startProbe:) _fTimer = [NSTimer scheduledTimerWithTimeInterval:CHECK_FIRE target:self selector:@selector(startProbe:)
userInfo:@(portNumber) userInfo:@(portNumber)
repeats:NO]; repeats:NO];
if (!delay) if (!delay)
{ {
[_fTimer fire]; [_fTimer fire];

View File

@ -237,8 +237,9 @@
self.fNatStatus = -1; self.fNatStatus = -1;
[self updatePortStatus]; [self updatePortStatus];
self.fPortStatusTimer = [NSTimer scheduledTimerWithTimeInterval:5.0 target:self selector:@selector(updatePortStatus) userInfo:nil self.fPortStatusTimer = [NSTimer scheduledTimerWithTimeInterval:5.0 target:self selector:@selector(updatePortStatus)
repeats:YES]; userInfo:nil
repeats:YES];
//set peer connections //set peer connections
self.fPeersGlobalField.intValue = [self.fDefaults integerForKey:@"PeersTotal"]; self.fPeersGlobalField.intValue = [self.fDefaults integerForKey:@"PeersTotal"];
@ -789,7 +790,7 @@
- (void)setSpeedLimit:(id)sender - (void)setSpeedLimit:(id)sender
{ {
[self.fDefaults setInteger:[sender intValue] [self.fDefaults setInteger:[sender intValue]
forKey:sender == self.fSpeedLimitUploadField ? @"SpeedLimitUploadLimit" : @"SpeedLimitDownloadLimit"]; forKey:sender == self.fSpeedLimitUploadField ? @"SpeedLimitUploadLimit" : @"SpeedLimitDownloadLimit"];
[self applyAltSpeedSettings]; [self applyAltSpeedSettings];
} }

View File

@ -83,8 +83,9 @@ OSStatus GeneratePreviewForURL(void* thisInterface, QLPreviewRequestRef preview,
NSString* fileSizeString = [NSString stringForFileSize:metainfo.totalSize()]; NSString* fileSizeString = [NSString stringForFileSize:metainfo.totalSize()];
if (is_multifile) if (is_multifile)
{ {
NSString* fileCountString = [NSString stringWithFormat:NSLocalizedStringFromTableInBundle(@"%@ files", nil, bundle, "quicklook file count"), NSString* fileCountString = [NSString
[NSString formattedUInteger:n_files]]; stringWithFormat:NSLocalizedStringFromTableInBundle(@"%@ files", nil, bundle, "quicklook file count"),
[NSString formattedUInteger:n_files]];
fileSizeString = [NSString stringWithFormat:@"%@, %@", fileCountString, fileSizeString]; fileSizeString = [NSString stringWithFormat:@"%@, %@", fileCountString, fileSizeString];
} }
[htmlString appendFormat:@"<p>%@</p>", fileSizeString]; [htmlString appendFormat:@"<p>%@</p>", fileSizeString];
@ -184,8 +185,9 @@ OSStatus GeneratePreviewForURL(void* thisInterface, QLPreviewRequestRef preview,
NSMutableString* listSection = [NSMutableString string]; NSMutableString* listSection = [NSMutableString string];
[listSection appendString:@"<table>"]; [listSection appendString:@"<table>"];
NSString* fileTitleString = [NSString stringWithFormat:NSLocalizedStringFromTableInBundle(@"%@ Files", nil, bundle, "quicklook file header"), NSString* fileTitleString = [NSString
[NSString formattedUInteger:n_files]]; stringWithFormat:NSLocalizedStringFromTableInBundle(@"%@ Files", nil, bundle, "quicklook file header"),
[NSString formattedUInteger:n_files]];
[listSection appendFormat:@"<tr><th>%@</th></tr>", fileTitleString]; [listSection appendFormat:@"<tr><th>%@</th></tr>", fileTitleString];
#warning display size? #warning display size?

View File

@ -60,8 +60,9 @@ tr_session* fLib = NULL;
{ {
[self updateStats]; [self updateStats];
self.fTimer = [NSTimer scheduledTimerWithTimeInterval:UPDATE_SECONDS target:self selector:@selector(updateStats) userInfo:nil self.fTimer = [NSTimer scheduledTimerWithTimeInterval:UPDATE_SECONDS target:self selector:@selector(updateStats)
repeats:YES]; userInfo:nil
repeats:YES];
[NSRunLoop.currentRunLoop addTimer:self.fTimer forMode:NSModalPanelRunLoopMode]; [NSRunLoop.currentRunLoop addTimer:self.fTimer forMode:NSModalPanelRunLoopMode];
[NSRunLoop.currentRunLoop addTimer:self.fTimer forMode:NSEventTrackingRunLoopMode]; [NSRunLoop.currentRunLoop addTimer:self.fTimer forMode:NSEventTrackingRunLoopMode];
@ -79,7 +80,13 @@ tr_session* fLib = NULL;
//size of all labels //size of all labels
CGFloat const oldWidth = self.fUploadedLabelField.frame.size.width; CGFloat const oldWidth = self.fUploadedLabelField.frame.size.width;
NSArray* labels = @[ self.fUploadedLabelField, self.fDownloadedLabelField, self.fRatioLabelField, self.fTimeLabelField, self.fNumOpenedLabelField ]; NSArray* labels = @[
self.fUploadedLabelField,
self.fDownloadedLabelField,
self.fRatioLabelField,
self.fTimeLabelField,
self.fNumOpenedLabelField
];
CGFloat maxWidth = CGFLOAT_MIN; CGFloat maxWidth = CGFLOAT_MIN;
for (NSTextField* label in labels) for (NSTextField* label in labels)
@ -211,7 +218,7 @@ tr_session* fLib = NULL;
self.fTimeField.stringValue = [timeFormatter stringFromTimeInterval:statsSession.secondsActive]; self.fTimeField.stringValue = [timeFormatter stringFromTimeInterval:statsSession.secondsActive];
self.fTimeAllField.stringValue = [NSString stringWithFormat:NSLocalizedString(@"%@ total", "stats total"), self.fTimeAllField.stringValue = [NSString stringWithFormat:NSLocalizedString(@"%@ total", "stats total"),
[timeFormatter stringFromTimeInterval:statsAll.secondsActive]]; [timeFormatter stringFromTimeInterval:statsAll.secondsActive]];
if (statsAll.sessionCount == 1) if (statsAll.sessionCount == 1)
{ {
@ -220,7 +227,7 @@ tr_session* fLib = NULL;
else else
{ {
self.fNumOpenedField.stringValue = [NSString stringWithFormat:NSLocalizedString(@"%@ times", "stats window -> times opened"), self.fNumOpenedField.stringValue = [NSString stringWithFormat:NSLocalizedString(@"%@ times", "stats window -> times opened"),
[NSString formattedUInteger:statsAll.sessionCount]]; [NSString formattedUInteger:statsAll.sessionCount]];
} }
} }

View File

@ -238,9 +238,9 @@ typedef NS_ENUM(unsigned int, statusTag) {
statusLabel = STATUS_RATIO_TOTAL; statusLabel = STATUS_RATIO_TOTAL;
} }
menuItem.state = [statusLabel isEqualToString:[NSUserDefaults.standardUserDefaults stringForKey:@"StatusLabel"]] menuItem.state = [statusLabel isEqualToString:[NSUserDefaults.standardUserDefaults stringForKey:@"StatusLabel"]] ?
? NSControlStateValueOn NSControlStateValueOn :
: NSControlStateValueOff; NSControlStateValueOff;
return YES; return YES;
} }

View File

@ -199,7 +199,7 @@ bool trashDataFile(char const* filename, tr_error** error)
{ {
//restore GroupValue //restore GroupValue
torrent.groupValue = [history[@"GroupValue"] intValue]; torrent.groupValue = [history[@"GroupValue"] intValue];
//start transfer //start transfer
NSNumber* active; NSNumber* active;
if (!pause && (active = history[@"Active"]) && active.boolValue) if (!pause && (active = history[@"Active"]) && active.boolValue)
@ -1873,7 +1873,11 @@ bool trashDataFile(char const* filename, tr_error** error)
tempNode = [[FileListNode alloc] initWithFolderName:pathComponents[0] path:@"" torrent:self]; tempNode = [[FileListNode alloc] initWithFolderName:pathComponents[0] path:@"" torrent:self];
} }
[self insertPathForComponents:pathComponents withComponentIndex:1 forParent:tempNode fileSize:file.length index:i [self insertPathForComponents:pathComponents
withComponentIndex:1
forParent:tempNode
fileSize:file.length
index:i
flatList:flatFileList]; flatList:flatFileList];
} }

View File

@ -186,10 +186,8 @@
{ {
[NSApp sendEvent:event]; [NSApp sendEvent:event];
} }
event = [controlView.window nextEventMatchingMask:(NSEventMaskLeftMouseUp | event = [controlView.window nextEventMatchingMask:(NSEventMaskLeftMouseUp | NSEventMaskLeftMouseDragged |
NSEventMaskLeftMouseDragged | NSEventMaskMouseEntered | NSEventMaskMouseExited)];
NSEventMaskMouseEntered |
NSEventMaskMouseExited)];
} }
self.fTracking = NO; self.fTracking = NO;
@ -332,7 +330,8 @@
if (!minimal || !(!self.fTracking && self.hoverAction)) //don't show in minimal mode when hovered over if (!minimal || !(!self.fTracking && self.hoverAction)) //don't show in minimal mode when hovered over
{ {
NSImage* icon = (minimal && error) ? [NSImage imageNamed:NSImageNameCaution] : torrent.icon; NSImage* icon = (minimal && error) ? [NSImage imageNamed:NSImageNameCaution] : torrent.icon;
[icon drawInRect:iconRect fromRect:NSZeroRect operation:NSCompositingOperationSourceOver fraction:1.0 respectFlipped:YES hints:nil]; [icon drawInRect:iconRect fromRect:NSZeroRect operation:NSCompositingOperationSourceOver fraction:1.0 respectFlipped:YES
hints:nil];
} }
//error badge //error badge
@ -340,7 +339,8 @@
{ {
NSImage* errorImage = [NSImage imageNamed:NSImageNameCaution]; NSImage* errorImage = [NSImage imageNamed:NSImageNameCaution];
NSRect const errorRect = NSMakeRect(NSMaxX(iconRect) - ERROR_IMAGE_SIZE, NSMaxY(iconRect) - ERROR_IMAGE_SIZE, ERROR_IMAGE_SIZE, ERROR_IMAGE_SIZE); NSRect const errorRect = NSMakeRect(NSMaxX(iconRect) - ERROR_IMAGE_SIZE, NSMaxY(iconRect) - ERROR_IMAGE_SIZE, ERROR_IMAGE_SIZE, ERROR_IMAGE_SIZE);
[errorImage drawInRect:errorRect fromRect:NSZeroRect operation:NSCompositingOperationSourceOver fraction:1.0 respectFlipped:YES [errorImage drawInRect:errorRect fromRect:NSZeroRect operation:NSCompositingOperationSourceOver fraction:1.0
respectFlipped:YES
hints:nil]; hints:nil];
} }
@ -422,7 +422,8 @@
} }
NSRect const controlRect = [self controlButtonRectForBounds:cellFrame]; NSRect const controlRect = [self controlButtonRectForBounds:cellFrame];
[controlImage drawInRect:controlRect fromRect:NSZeroRect operation:NSCompositingOperationSourceOver fraction:1.0 respectFlipped:YES [controlImage drawInRect:controlRect fromRect:NSZeroRect operation:NSCompositingOperationSourceOver fraction:1.0
respectFlipped:YES
hints:nil]; hints:nil];
minimalTitleRightBound = MIN(minimalTitleRightBound, NSMinX(controlRect)); minimalTitleRightBound = MIN(minimalTitleRightBound, NSMinX(controlRect));
@ -442,7 +443,8 @@
} }
NSImage* revealImage = [NSImage imageNamed:revealImageString]; NSImage* revealImage = [NSImage imageNamed:revealImageString];
[revealImage drawInRect:[self revealButtonRectForBounds:cellFrame] fromRect:NSZeroRect operation:NSCompositingOperationSourceOver [revealImage drawInRect:[self revealButtonRectForBounds:cellFrame] fromRect:NSZeroRect
operation:NSCompositingOperationSourceOver
fraction:1.0 fraction:1.0
respectFlipped:YES respectFlipped:YES
hints:nil]; hints:nil];
@ -489,8 +491,7 @@
PRIORITY_ICON_WIDTH, PRIORITY_ICON_WIDTH,
PRIORITY_ICON_HEIGHT); PRIORITY_ICON_HEIGHT);
NSColor* priorityColor = self.backgroundStyle == NSBackgroundStyleEmphasized ? NSColor.whiteColor NSColor* priorityColor = self.backgroundStyle == NSBackgroundStyleEmphasized ? NSColor.whiteColor : NSColor.labelColor;
: NSColor.labelColor;
NSImage* priorityImage = [[NSImage imageNamed:(torrent.priority == TR_PRI_HIGH ? @"PriorityHighTemplate" : @"PriorityLowTemplate")] NSImage* priorityImage = [[NSImage imageNamed:(torrent.priority == TR_PRI_HIGH ? @"PriorityHighTemplate" : @"PriorityLowTemplate")]
imageWithColor:priorityColor]; imageWithColor:priorityColor];

View File

@ -455,7 +455,8 @@
return; return;
} }
BOOL const pushed = row != -1 && (self.actionButtonHoverRow == row || self.revealButtonHoverRow == row || self.controlButtonHoverRow == row); BOOL const pushed = row != -1 &&
(self.actionButtonHoverRow == row || self.revealButtonHoverRow == row || self.controlButtonHoverRow == row);
//if pushing a button, don't change the selected rows //if pushing a button, don't change the selected rows
if (pushed) if (pushed)
@ -601,9 +602,7 @@
{ {
unichar const firstChar = [event.charactersIgnoringModifiers characterAtIndex:0]; unichar const firstChar = [event.charactersIgnoringModifiers characterAtIndex:0];
if (firstChar == 'f' && if (firstChar == 'f' && event.modifierFlags & NSEventModifierFlagOption && event.modifierFlags & NSEventModifierFlagCommand)
event.modifierFlags & NSEventModifierFlagOption &&
event.modifierFlags & NSEventModifierFlagCommand)
{ {
[self.fController focusFilterField]; [self.fController focusFilterField];
} }

View File

@ -197,11 +197,12 @@ NSMutableSet* fTrackerIconLoading;
return icon; return icon;
} }
if (@available(macOS 11.0, *)) { if (@available(macOS 11.0, *))
{
NSImage* result = [NSImage imageWithSystemSymbolName:@"globe" accessibilityDescription:nil]; NSImage* result = [NSImage imageWithSystemSymbolName:@"globe" accessibilityDescription:nil];
[result lockFocus]; [result lockFocus];
[NSColor.textColor set]; [NSColor.textColor set];
NSRect imageRect = {NSZeroPoint, [result size]}; NSRect imageRect = { NSZeroPoint, [result size] };
NSRectFillUsingOperation(imageRect, NSCompositingOperationSourceIn); NSRectFillUsingOperation(imageRect, NSCompositingOperationSourceIn);
[result unlockFocus]; [result unlockFocus];
return result; return result;

View File

@ -140,7 +140,8 @@
} }
else else
{ {
peerString = [NSString stringWithFormat:NSLocalizedString(@"got %d peers", "Tracker last announce"), self.fStat.lastAnnouncePeerCount]; peerString = [NSString stringWithFormat:NSLocalizedString(@"got %d peers", "Tracker last announce"),
self.fStat.lastAnnouncePeerCount];
} }
baseString = [baseString stringByAppendingFormat:@" (%@)", peerString]; baseString = [baseString stringByAppendingFormat:@" (%@)", peerString];
} }
@ -177,7 +178,7 @@
case TR_TRACKER_INACTIVE: case TR_TRACKER_INACTIVE:
return self.fStat.isBackup ? NSLocalizedString(@"Tracker will be used as a backup", "Tracker next announce") : return self.fStat.isBackup ? NSLocalizedString(@"Tracker will be used as a backup", "Tracker next announce") :
NSLocalizedString(@"Announce not scheduled", "Tracker next announce"); NSLocalizedString(@"Announce not scheduled", "Tracker next announce");
default: default:
NSAssert1(NO, @"unknown announce state: %d", self.fStat.announceState); NSAssert1(NO, @"unknown announce state: %d", self.fStat.announceState);