refactor: autogenerate the macOS client's Message Log dots (#3224)
* Replaces DotFlat png with generated icons * code review: udating popup item icons * code review: increasing inset
@@ -240,7 +240,6 @@ set(${PROJECT_NAME}_HIDPI_IMAGES
|
|||||||
ActionHover
|
ActionHover
|
||||||
ActionOn
|
ActionOn
|
||||||
Bandwidth
|
Bandwidth
|
||||||
BlueDotFlat
|
|
||||||
CleanupTemplate
|
CleanupTemplate
|
||||||
CompleteCheck
|
CompleteCheck
|
||||||
CreateLarge
|
CreateLarge
|
||||||
@@ -249,7 +248,6 @@ set(${PROJECT_NAME}_HIDPI_IMAGES
|
|||||||
FavIcon
|
FavIcon
|
||||||
GearshapeTemplate
|
GearshapeTemplate
|
||||||
Globe
|
Globe
|
||||||
GreenDotFlat
|
|
||||||
Groups
|
Groups
|
||||||
InfoActivity
|
InfoActivity
|
||||||
InfoFiles
|
InfoFiles
|
||||||
@@ -259,7 +257,6 @@ set(${PROJECT_NAME}_HIDPI_IMAGES
|
|||||||
InfoTracker
|
InfoTracker
|
||||||
Lock
|
Lock
|
||||||
Magnet
|
Magnet
|
||||||
OrangeDotFlat
|
|
||||||
PauseHover
|
PauseHover
|
||||||
PauseOff
|
PauseOff
|
||||||
PauseOn
|
PauseOn
|
||||||
@@ -270,8 +267,6 @@ set(${PROJECT_NAME}_HIDPI_IMAGES
|
|||||||
PriorityHighTemplate
|
PriorityHighTemplate
|
||||||
PriorityLowTemplate
|
PriorityLowTemplate
|
||||||
PriorityNormalTemplate
|
PriorityNormalTemplate
|
||||||
PurpleDotFlat
|
|
||||||
RedDotFlat
|
|
||||||
Remote
|
Remote
|
||||||
ResumeHover
|
ResumeHover
|
||||||
ResumeNoWaitHover
|
ResumeNoWaitHover
|
||||||
@@ -296,7 +291,6 @@ set(${PROJECT_NAME}_HIDPI_IMAGES
|
|||||||
Transfers
|
Transfers
|
||||||
UpArrowGroupTemplate
|
UpArrowGroupTemplate
|
||||||
UpArrowTemplate
|
UpArrowTemplate
|
||||||
YellowDotFlat
|
|
||||||
YingYangGroupTemplate
|
YingYangGroupTemplate
|
||||||
YingYangTemplate
|
YingYangTemplate
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -48,7 +48,6 @@
|
|||||||
#import "BonjourController.h"
|
#import "BonjourController.h"
|
||||||
#import "Badger.h"
|
#import "Badger.h"
|
||||||
#import "DragOverlayWindow.h"
|
#import "DragOverlayWindow.h"
|
||||||
#import "NSApplicationAdditions.h"
|
|
||||||
#import "NSImageAdditions.h"
|
#import "NSImageAdditions.h"
|
||||||
#import "NSMutableArrayAdditions.h"
|
#import "NSMutableArrayAdditions.h"
|
||||||
#import "NSStringAdditions.h"
|
#import "NSStringAdditions.h"
|
||||||
|
|||||||
@@ -10,7 +10,6 @@
|
|||||||
|
|
||||||
#import "CreatorWindowController.h"
|
#import "CreatorWindowController.h"
|
||||||
#import "Controller.h"
|
#import "Controller.h"
|
||||||
#import "NSApplicationAdditions.h"
|
|
||||||
#import "NSStringAdditions.h"
|
#import "NSStringAdditions.h"
|
||||||
|
|
||||||
#define TRACKER_ADD_TAG 0
|
#define TRACKER_ADD_TAG 0
|
||||||
|
|||||||
@@ -10,7 +10,6 @@
|
|||||||
#import "FileOutlineView.h"
|
#import "FileOutlineView.h"
|
||||||
#import "FilePriorityCell.h"
|
#import "FilePriorityCell.h"
|
||||||
#import "FileRenameSheetController.h"
|
#import "FileRenameSheetController.h"
|
||||||
#import "NSApplicationAdditions.h"
|
|
||||||
#import "NSMutableArrayAdditions.h"
|
#import "NSMutableArrayAdditions.h"
|
||||||
#import "NSStringAdditions.h"
|
#import "NSStringAdditions.h"
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
// License text can be found in the licenses/ folder.
|
// License text can be found in the licenses/ folder.
|
||||||
|
|
||||||
#import "FilterBarView.h"
|
#import "FilterBarView.h"
|
||||||
#import "NSApplicationAdditions.h"
|
|
||||||
|
|
||||||
@implementation FilterBarView
|
@implementation FilterBarView
|
||||||
|
|
||||||
|
|||||||
@@ -3,8 +3,8 @@
|
|||||||
// License text can be found in the licenses/ folder.
|
// License text can be found in the licenses/ folder.
|
||||||
|
|
||||||
#import "GroupsController.h"
|
#import "GroupsController.h"
|
||||||
|
#import "NSImageAdditions.h"
|
||||||
#import "NSMutableArrayAdditions.h"
|
#import "NSMutableArrayAdditions.h"
|
||||||
#import "NSApplicationAdditions.h"
|
|
||||||
|
|
||||||
#define ICON_WIDTH 16.0
|
#define ICON_WIDTH 16.0
|
||||||
#define BORDER_WIDTH 1.25
|
#define BORDER_WIDTH 1.25
|
||||||
@@ -409,26 +409,7 @@ GroupsController* fGroupsInstance = nil;
|
|||||||
return icon;
|
return icon;
|
||||||
}
|
}
|
||||||
|
|
||||||
NSColor* color = dict[@"Color"];
|
icon = [NSImage discIconWithColor:dict[@"Color"] insetFactor:0];
|
||||||
|
|
||||||
icon = [NSImage imageWithSize:NSMakeSize(ICON_WIDTH, ICON_WIDTH) flipped:NO drawingHandler:^BOOL(NSRect rect) {
|
|
||||||
//shape
|
|
||||||
rect = NSInsetRect(rect, BORDER_WIDTH / 2, BORDER_WIDTH / 2);
|
|
||||||
NSBezierPath* bp = [NSBezierPath bezierPathWithOvalInRect:rect];
|
|
||||||
bp.lineWidth = BORDER_WIDTH;
|
|
||||||
|
|
||||||
//border
|
|
||||||
CGFloat fractionOfBlendedColor = [NSApp isDarkMode] ? 0.15 : 0.3;
|
|
||||||
NSColor* borderColor = [color blendedColorWithFraction:fractionOfBlendedColor ofColor:NSColor.controlTextColor];
|
|
||||||
[borderColor setStroke];
|
|
||||||
[bp stroke];
|
|
||||||
|
|
||||||
//inside
|
|
||||||
[color setFill];
|
|
||||||
[bp fill];
|
|
||||||
|
|
||||||
return YES;
|
|
||||||
}];
|
|
||||||
|
|
||||||
dict[@"Icon"] = icon;
|
dict[@"Icon"] = icon;
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,6 @@
|
|||||||
#import "GroupsController.h"
|
#import "GroupsController.h"
|
||||||
#import "ExpandedPathToPathTransformer.h"
|
#import "ExpandedPathToPathTransformer.h"
|
||||||
#import "ExpandedPathToIconTransformer.h"
|
#import "ExpandedPathToIconTransformer.h"
|
||||||
#import "NSApplicationAdditions.h"
|
|
||||||
|
|
||||||
#define GROUP_TABLE_VIEW_DATA_TYPE @"GroupTableViewDataType"
|
#define GROUP_TABLE_VIEW_DATA_TYPE @"GroupTableViewDataType"
|
||||||
|
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 357 B |
|
Before Width: | Height: | Size: 520 B |
@@ -1,21 +0,0 @@
|
|||||||
{
|
|
||||||
"images" : [
|
|
||||||
{
|
|
||||||
"idiom" : "mac",
|
|
||||||
"filename" : "BlueDotFlat.png",
|
|
||||||
"scale" : "1x"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"idiom" : "mac",
|
|
||||||
"filename" : "BlueDotFlat@2x.png",
|
|
||||||
"scale" : "2x"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"info" : {
|
|
||||||
"version" : 1,
|
|
||||||
"author" : "xcode"
|
|
||||||
},
|
|
||||||
"properties" : {
|
|
||||||
"template-rendering-intent" : "original"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
{
|
|
||||||
"images" : [
|
|
||||||
{
|
|
||||||
"idiom" : "mac",
|
|
||||||
"filename" : "GreenDotFlat.png",
|
|
||||||
"scale" : "1x"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"idiom" : "mac",
|
|
||||||
"filename" : "GreenDotFlat@2x.png",
|
|
||||||
"scale" : "2x"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"info" : {
|
|
||||||
"version" : 1,
|
|
||||||
"author" : "xcode"
|
|
||||||
},
|
|
||||||
"properties" : {
|
|
||||||
"template-rendering-intent" : "original"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
Before Width: | Height: | Size: 424 B |
|
Before Width: | Height: | Size: 611 B |
@@ -1,21 +0,0 @@
|
|||||||
{
|
|
||||||
"images" : [
|
|
||||||
{
|
|
||||||
"idiom" : "mac",
|
|
||||||
"filename" : "OrangeDotFlat.png",
|
|
||||||
"scale" : "1x"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"idiom" : "mac",
|
|
||||||
"filename" : "OrangeDotFlat@2x.png",
|
|
||||||
"scale" : "2x"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"info" : {
|
|
||||||
"version" : 1,
|
|
||||||
"author" : "xcode"
|
|
||||||
},
|
|
||||||
"properties" : {
|
|
||||||
"template-rendering-intent" : "original"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
Before Width: | Height: | Size: 371 B |
|
Before Width: | Height: | Size: 532 B |
@@ -1,21 +0,0 @@
|
|||||||
{
|
|
||||||
"images" : [
|
|
||||||
{
|
|
||||||
"idiom" : "mac",
|
|
||||||
"filename" : "PurpleDotFlat.png",
|
|
||||||
"scale" : "1x"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"idiom" : "mac",
|
|
||||||
"filename" : "PurpleDotFlat@2x.png",
|
|
||||||
"scale" : "2x"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"info" : {
|
|
||||||
"version" : 1,
|
|
||||||
"author" : "xcode"
|
|
||||||
},
|
|
||||||
"properties" : {
|
|
||||||
"template-rendering-intent" : "original"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
Before Width: | Height: | Size: 381 B |
|
Before Width: | Height: | Size: 543 B |
@@ -1,21 +0,0 @@
|
|||||||
{
|
|
||||||
"images" : [
|
|
||||||
{
|
|
||||||
"idiom" : "mac",
|
|
||||||
"filename" : "RedDotFlat.png",
|
|
||||||
"scale" : "1x"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"idiom" : "mac",
|
|
||||||
"filename" : "RedDotFlat@2x.png",
|
|
||||||
"scale" : "2x"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"info" : {
|
|
||||||
"version" : 1,
|
|
||||||
"author" : "xcode"
|
|
||||||
},
|
|
||||||
"properties" : {
|
|
||||||
"template-rendering-intent" : "original"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
Before Width: | Height: | Size: 340 B |
|
Before Width: | Height: | Size: 542 B |
@@ -1,21 +0,0 @@
|
|||||||
{
|
|
||||||
"images" : [
|
|
||||||
{
|
|
||||||
"idiom" : "mac",
|
|
||||||
"filename" : "YellowDotFlat.png",
|
|
||||||
"scale" : "1x"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"idiom" : "mac",
|
|
||||||
"filename" : "YellowDotFlat@2x.png",
|
|
||||||
"scale" : "2x"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"info" : {
|
|
||||||
"version" : 1,
|
|
||||||
"author" : "xcode"
|
|
||||||
},
|
|
||||||
"properties" : {
|
|
||||||
"template-rendering-intent" : "original"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
Before Width: | Height: | Size: 418 B |
|
Before Width: | Height: | Size: 575 B |
@@ -6,7 +6,6 @@
|
|||||||
#include <libtransmission/utils.h> //tr_getRatio()
|
#include <libtransmission/utils.h> //tr_getRatio()
|
||||||
|
|
||||||
#import "InfoActivityViewController.h"
|
#import "InfoActivityViewController.h"
|
||||||
#import "NSApplicationAdditions.h"
|
|
||||||
#import "NSStringAdditions.h"
|
#import "NSStringAdditions.h"
|
||||||
#import "PiecesView.h"
|
#import "PiecesView.h"
|
||||||
#import "Torrent.h"
|
#import "Torrent.h"
|
||||||
|
|||||||
@@ -6,7 +6,6 @@
|
|||||||
#include <libtransmission/utils.h>
|
#include <libtransmission/utils.h>
|
||||||
|
|
||||||
#import "InfoPeersViewController.h"
|
#import "InfoPeersViewController.h"
|
||||||
#import "NSApplicationAdditions.h"
|
|
||||||
#import "NSStringAdditions.h"
|
#import "NSStringAdditions.h"
|
||||||
#import "PeerProgressIndicatorCell.h"
|
#import "PeerProgressIndicatorCell.h"
|
||||||
#import "Torrent.h"
|
#import "Torrent.h"
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
// License text can be found in the licenses/ folder.
|
// License text can be found in the licenses/ folder.
|
||||||
|
|
||||||
#import "InfoTrackersViewController.h"
|
#import "InfoTrackersViewController.h"
|
||||||
#import "NSApplicationAdditions.h"
|
|
||||||
#import "Torrent.h"
|
#import "Torrent.h"
|
||||||
#import "TrackerCell.h"
|
#import "TrackerCell.h"
|
||||||
#import "TrackerNode.h"
|
#import "TrackerNode.h"
|
||||||
|
|||||||
@@ -11,7 +11,6 @@
|
|||||||
#import "InfoFileViewController.h"
|
#import "InfoFileViewController.h"
|
||||||
#import "InfoOptionsViewController.h"
|
#import "InfoOptionsViewController.h"
|
||||||
#import "NSImageAdditions.h"
|
#import "NSImageAdditions.h"
|
||||||
#import "NSApplicationAdditions.h"
|
|
||||||
#import "NSStringAdditions.h"
|
#import "NSStringAdditions.h"
|
||||||
#import "Torrent.h"
|
#import "Torrent.h"
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="19529" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
|
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="20037" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<deployment identifier="macosx"/>
|
<deployment identifier="macosx"/>
|
||||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="19529"/>
|
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="20037"/>
|
||||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<objects>
|
<objects>
|
||||||
@@ -42,16 +42,16 @@
|
|||||||
<popUpButton verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="15">
|
<popUpButton verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="15">
|
||||||
<rect key="frame" x="20" y="5" width="101" height="25"/>
|
<rect key="frame" x="20" y="5" width="101" height="25"/>
|
||||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||||
<popUpButtonCell key="cell" type="roundTextured" title="Error" bezelStyle="texturedRounded" imagePosition="left" alignment="left" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" inset="2" preferredEdge="maxY" selectedItem="17" id="60">
|
<popUpButtonCell key="cell" type="roundTextured" bezelStyle="texturedRounded" imagePosition="left" alignment="left" lineBreakMode="truncatingTail" borderStyle="borderAndBezel" inset="2" preferredEdge="maxY" id="60">
|
||||||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
||||||
<font key="font" metaFont="menu"/>
|
<font key="font" metaFont="menu"/>
|
||||||
<menu key="menu" title="OtherViews" id="16">
|
<menu key="menu" id="16">
|
||||||
<items>
|
<items>
|
||||||
<menuItem title="Error" state="on" image="RedDotFlat"/>
|
<menuItem title="Error" image="NSStatusUnavailable" id="menuItemError"/>
|
||||||
<menuItem title="Warn" image="OrangeDotFlat"/>
|
<menuItem title="Warn" image="NSStatusPartiallyAvailable" id="menuItemWarn"/>
|
||||||
<menuItem title="Info" image="GreenDotFlat"/>
|
<menuItem title="Info" image="NSStatusAvailable" id="menuItemInfo"/>
|
||||||
<menuItem title="Debug" image="BlueDotFlat"/>
|
<menuItem title="Debug" image="NSStatusNone" id="menuItemDebug"/>
|
||||||
<menuItem title="Trace" image="PurpleDotFlat"/>
|
<menuItem title="Trace" image="NSStatusNone" id="menuItemTracer"/>
|
||||||
</items>
|
</items>
|
||||||
</menu>
|
</menu>
|
||||||
</popUpButtonCell>
|
</popUpButtonCell>
|
||||||
@@ -174,9 +174,10 @@
|
|||||||
</window>
|
</window>
|
||||||
</objects>
|
</objects>
|
||||||
<resources>
|
<resources>
|
||||||
<image name="PurpleDotFlat" width="16" height="16"/>
|
<image name="NSStatusAvailable" width="16" height="16"/>
|
||||||
<image name="RedDotFlat" width="16" height="16"/>
|
<image name="NSStatusNone" width="16" height="16"/>
|
||||||
<image name="YellowDotFlat" width="16" height="16"/>
|
<image name="NSStatusPartiallyAvailable" width="16" height="16"/>
|
||||||
|
<image name="NSStatusUnavailable" width="16" height="16"/>
|
||||||
<image name="imageCell:63:image" width="14" height="14">
|
<image name="imageCell:63:image" width="14" height="14">
|
||||||
<mutableData key="keyedArchiveRepresentation">
|
<mutableData key="keyedArchiveRepresentation">
|
||||||
YnBsaXN0MDDUAQIDBAUGBwpYJHZlcnNpb25ZJGFyY2hpdmVyVCR0b3BYJG9iamVjdHMSAAGGoF8QD05T
|
YnBsaXN0MDDUAQIDBAUGBwpYJHZlcnNpb25ZJGFyY2hpdmVyVCR0b3BYJG9iamVjdHMSAAGGoF8QD05T
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
#import "MessageWindowController.h"
|
#import "MessageWindowController.h"
|
||||||
#import "Controller.h"
|
#import "Controller.h"
|
||||||
#import "NSApplicationAdditions.h"
|
#import "NSImageAdditions.h"
|
||||||
#import "NSMutableArrayAdditions.h"
|
#import "NSMutableArrayAdditions.h"
|
||||||
#import "NSStringAdditions.h"
|
#import "NSStringAdditions.h"
|
||||||
|
|
||||||
@@ -75,6 +75,11 @@
|
|||||||
[self.fLevelButton itemAtIndex:LEVEL_INFO].title = NSLocalizedString(@"Info", "Message window -> level string");
|
[self.fLevelButton itemAtIndex:LEVEL_INFO].title = NSLocalizedString(@"Info", "Message window -> level string");
|
||||||
[self.fLevelButton itemAtIndex:LEVEL_DEBUG].title = NSLocalizedString(@"Debug", "Message window -> level string");
|
[self.fLevelButton itemAtIndex:LEVEL_DEBUG].title = NSLocalizedString(@"Debug", "Message window -> level string");
|
||||||
[self.fLevelButton itemAtIndex:LEVEL_TRACE].title = NSLocalizedString(@"Trace", "Message window -> level string");
|
[self.fLevelButton itemAtIndex:LEVEL_TRACE].title = NSLocalizedString(@"Trace", "Message window -> level string");
|
||||||
|
[self.fLevelButton itemAtIndex:LEVEL_ERROR].image = [self.class iconForLevel:TR_LOG_ERROR];
|
||||||
|
[self.fLevelButton itemAtIndex:LEVEL_WARN].image = [self.class iconForLevel:TR_LOG_WARN];
|
||||||
|
[self.fLevelButton itemAtIndex:LEVEL_INFO].image = [self.class iconForLevel:TR_LOG_INFO];
|
||||||
|
[self.fLevelButton itemAtIndex:LEVEL_DEBUG].image = [self.class iconForLevel:TR_LOG_DEBUG];
|
||||||
|
[self.fLevelButton itemAtIndex:LEVEL_TRACE].image = [self.class iconForLevel:TR_LOG_TRACE];
|
||||||
|
|
||||||
CGFloat const levelButtonOldWidth = NSWidth(self.fLevelButton.frame);
|
CGFloat const levelButtonOldWidth = NSWidth(self.fLevelButton.frame);
|
||||||
[self.fLevelButton sizeToFit];
|
[self.fLevelButton sizeToFit];
|
||||||
@@ -182,6 +187,56 @@
|
|||||||
[self updateLog:nil];
|
[self updateLog:nil];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
+ (NSImage*)iconForLevel:(NSInteger)level
|
||||||
|
{
|
||||||
|
NSColor* color;
|
||||||
|
switch (level)
|
||||||
|
{
|
||||||
|
case TR_LOG_CRITICAL:
|
||||||
|
case TR_LOG_ERROR:
|
||||||
|
color = NSColor.systemRedColor;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case TR_LOG_WARN:
|
||||||
|
color = NSColor.systemOrangeColor;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case TR_LOG_INFO:
|
||||||
|
color = NSColor.systemGreenColor;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case TR_LOG_DEBUG:
|
||||||
|
if (@available(macOS 10.12, *))
|
||||||
|
{
|
||||||
|
color = NSColor.systemTealColor;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
color = NSColor.cyanColor;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case TR_LOG_TRACE:
|
||||||
|
color = NSColor.systemPurpleColor;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
NSAssert1(NO, @"Unknown message log level: %ld", level);
|
||||||
|
return nil;
|
||||||
|
}
|
||||||
|
|
||||||
|
// cache dictionary
|
||||||
|
static NSMutableDictionary<NSColor*, NSImage*>* icons = [NSMutableDictionary dictionary];
|
||||||
|
NSImage* icon;
|
||||||
|
if ((icon = icons[color]))
|
||||||
|
{
|
||||||
|
return icon;
|
||||||
|
}
|
||||||
|
icon = [NSImage discIconWithColor:color insetFactor:0.5];
|
||||||
|
icons[color] = icon;
|
||||||
|
return icon;
|
||||||
|
}
|
||||||
|
|
||||||
- (void)updateLog:(NSTimer*)timer
|
- (void)updateLog:(NSTimer*)timer
|
||||||
{
|
{
|
||||||
tr_log_message* messages;
|
tr_log_message* messages;
|
||||||
@@ -269,28 +324,7 @@
|
|||||||
else if ([ident isEqualToString:@"Level"])
|
else if ([ident isEqualToString:@"Level"])
|
||||||
{
|
{
|
||||||
NSInteger const level = [message[@"Level"] integerValue];
|
NSInteger const level = [message[@"Level"] integerValue];
|
||||||
switch (level)
|
return [self.class iconForLevel:level];
|
||||||
{
|
|
||||||
case TR_LOG_CRITICAL:
|
|
||||||
case TR_LOG_ERROR:
|
|
||||||
return [NSImage imageNamed:@"RedDotFlat"];
|
|
||||||
|
|
||||||
case TR_LOG_WARN:
|
|
||||||
return [NSImage imageNamed:@"OrangeDotFlat"];
|
|
||||||
|
|
||||||
case TR_LOG_INFO:
|
|
||||||
return [NSImage imageNamed:@"GreenDotFlat"];
|
|
||||||
|
|
||||||
case TR_LOG_DEBUG:
|
|
||||||
return [NSImage imageNamed:@"BlueDotFlat"];
|
|
||||||
|
|
||||||
case TR_LOG_TRACE:
|
|
||||||
return [NSImage imageNamed:@"PurpleDotFlat"];
|
|
||||||
|
|
||||||
default:
|
|
||||||
NSAssert1(NO, @"Unknown message log level: %ld", level);
|
|
||||||
return nil;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if ([ident isEqualToString:@"Name"])
|
else if ([ident isEqualToString:@"Name"])
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,7 +6,6 @@
|
|||||||
|
|
||||||
@interface NSApplication (NSApplicationAdditions)
|
@interface NSApplication (NSApplicationAdditions)
|
||||||
|
|
||||||
@property(nonatomic, getter=isOnMojaveOrBetter, readonly) BOOL onMojaveOrBetter;
|
|
||||||
@property(nonatomic, getter=isDarkMode, readonly) BOOL darkMode;
|
@property(nonatomic, getter=isDarkMode, readonly) BOOL darkMode;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
@@ -6,11 +6,6 @@
|
|||||||
|
|
||||||
@implementation NSApplication (NSApplicationAdditions)
|
@implementation NSApplication (NSApplicationAdditions)
|
||||||
|
|
||||||
- (BOOL)isOnMojaveOrBetter
|
|
||||||
{
|
|
||||||
return floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_13;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (BOOL)isDarkMode
|
- (BOOL)isDarkMode
|
||||||
{
|
{
|
||||||
if (@available(macOS 10.14, *))
|
if (@available(macOS 10.14, *))
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
@interface NSImage (NSImageAdditions)
|
@interface NSImage (NSImageAdditions)
|
||||||
|
|
||||||
|
+ (NSImage*)discIconWithColor:(NSColor*)color insetFactor:(CGFloat)insetFactor;
|
||||||
- (NSImage*)imageWithColor:(NSColor*)color;
|
- (NSImage*)imageWithColor:(NSColor*)color;
|
||||||
|
|
||||||
/* macOS < 11 compatibility */
|
/* macOS < 11 compatibility */
|
||||||
|
|||||||
@@ -5,9 +5,35 @@
|
|||||||
#import "CocoaCompatibility.h"
|
#import "CocoaCompatibility.h"
|
||||||
|
|
||||||
#import "NSImageAdditions.h"
|
#import "NSImageAdditions.h"
|
||||||
|
#import "NSApplicationAdditions.h"
|
||||||
|
|
||||||
@implementation NSImage (NSImageAdditions)
|
@implementation NSImage (NSImageAdditions)
|
||||||
|
|
||||||
|
#define ICON_WIDTH 16.0
|
||||||
|
#define BORDER_WIDTH 1.25
|
||||||
|
|
||||||
|
+ (NSImage*)discIconWithColor:(NSColor*)color insetFactor:(CGFloat)insetFactor
|
||||||
|
{
|
||||||
|
return [NSImage imageWithSize:NSMakeSize(ICON_WIDTH, ICON_WIDTH) flipped:NO drawingHandler:^BOOL(NSRect rect) {
|
||||||
|
//shape
|
||||||
|
rect = NSInsetRect(rect, BORDER_WIDTH / 2 + rect.size.width * insetFactor / 2, BORDER_WIDTH / 2 + rect.size.height * insetFactor / 2);
|
||||||
|
NSBezierPath* bp = [NSBezierPath bezierPathWithOvalInRect:rect];
|
||||||
|
bp.lineWidth = BORDER_WIDTH;
|
||||||
|
|
||||||
|
//border
|
||||||
|
CGFloat fractionOfBlendedColor = [NSApp isDarkMode] ? 0.15 : 0.3;
|
||||||
|
NSColor* borderColor = [color blendedColorWithFraction:fractionOfBlendedColor ofColor:NSColor.controlTextColor];
|
||||||
|
[borderColor setStroke];
|
||||||
|
[bp stroke];
|
||||||
|
|
||||||
|
//inside
|
||||||
|
[color setFill];
|
||||||
|
[bp fill];
|
||||||
|
|
||||||
|
return YES;
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
|
||||||
- (NSImage*)imageWithColor:(NSColor*)color
|
- (NSImage*)imageWithColor:(NSColor*)color
|
||||||
{
|
{
|
||||||
NSImage* coloredImage = [self copy];
|
NSImage* coloredImage = [self copy];
|
||||||
|
|||||||
@@ -17,7 +17,6 @@
|
|||||||
#import "Controller.h"
|
#import "Controller.h"
|
||||||
#import "PortChecker.h"
|
#import "PortChecker.h"
|
||||||
#import "BonjourController.h"
|
#import "BonjourController.h"
|
||||||
#import "NSApplicationAdditions.h"
|
|
||||||
#import "NSImageAdditions.h"
|
#import "NSImageAdditions.h"
|
||||||
#import "NSStringAdditions.h"
|
#import "NSStringAdditions.h"
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
#import "ShareToolbarItem.h"
|
#import "ShareToolbarItem.h"
|
||||||
#import "ShareTorrentFileHelper.h"
|
#import "ShareTorrentFileHelper.h"
|
||||||
#import "NSApplicationAdditions.h"
|
|
||||||
|
|
||||||
@implementation ShareToolbarItem
|
@implementation ShareToolbarItem
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
|
|
||||||
#import "StatsWindowController.h"
|
#import "StatsWindowController.h"
|
||||||
#import "Controller.h"
|
#import "Controller.h"
|
||||||
#import "NSApplicationAdditions.h"
|
|
||||||
#import "NSStringAdditions.h"
|
#import "NSStringAdditions.h"
|
||||||
|
|
||||||
#define UPDATE_SECONDS 1.0
|
#define UPDATE_SECONDS 1.0
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
// License text can be found in the licenses/ folder.
|
// License text can be found in the licenses/ folder.
|
||||||
|
|
||||||
#import "StatusBarView.h"
|
#import "StatusBarView.h"
|
||||||
#import "NSApplicationAdditions.h"
|
|
||||||
|
|
||||||
@interface StatusBarView ()
|
@interface StatusBarView ()
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,6 @@
|
|||||||
#import "Torrent.h"
|
#import "Torrent.h"
|
||||||
#import "GroupsController.h"
|
#import "GroupsController.h"
|
||||||
#import "FileListNode.h"
|
#import "FileListNode.h"
|
||||||
#import "NSApplicationAdditions.h"
|
|
||||||
#import "NSStringAdditions.h"
|
#import "NSStringAdditions.h"
|
||||||
#import "TrackerNode.h"
|
#import "TrackerNode.h"
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,6 @@
|
|||||||
#import "Controller.h"
|
#import "Controller.h"
|
||||||
#import "FileListNode.h"
|
#import "FileListNode.h"
|
||||||
#import "InfoOptionsViewController.h"
|
#import "InfoOptionsViewController.h"
|
||||||
#import "NSApplicationAdditions.h"
|
|
||||||
#import "NSStringAdditions.h"
|
#import "NSStringAdditions.h"
|
||||||
#import "Torrent.h"
|
#import "Torrent.h"
|
||||||
#import "TorrentCell.h"
|
#import "TorrentCell.h"
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
// License text can be found in the licenses/ folder.
|
// License text can be found in the licenses/ folder.
|
||||||
|
|
||||||
#import "TrackerNode.h"
|
#import "TrackerNode.h"
|
||||||
#import "NSApplicationAdditions.h"
|
|
||||||
#import "NSStringAdditions.h"
|
#import "NSStringAdditions.h"
|
||||||
|
|
||||||
@interface TrackerNode ()
|
@interface TrackerNode ()
|
||||||
|
|||||||