Fix #484. Remove "Shadowsocks-NG" and keep the "SIP002" and "Legacy" on the qrcode.

This commit is contained in:
Qiu Yuzhou
2017-09-16 17:16:51 +08:00
parent 19c8d047eb
commit a32bd42c65

View File

@ -19,7 +19,7 @@
[super windowDidLoad]; [super windowDidLoad];
// Implement this method to handle any initialization after your window controller's window has been loaded from its nib file. // Implement this method to handle any initialization after your window controller's window has been loaded from its nib file.
[self setQRCode:self.qrCode withOverlayText:@"Shadowsocks-NG SIP002"]; [self setQRCode:self.qrCode withOverlayText:@"SIP002"];
} }
- (void)setQRCode:(NSString*) qrCode withOverlayText: (NSString*) text { - (void)setQRCode:(NSString*) qrCode withOverlayText: (NSString*) text {
@ -35,14 +35,9 @@
}; };
NSMutableAttributedString* attrsText = [[NSMutableAttributedString alloc] initWithString: text NSMutableAttributedString* attrsText = [[NSMutableAttributedString alloc] initWithString: text
attributes: attrs]; attributes: attrs];
[attrsText setAttributes:@{
NSForegroundColorAttributeName: [NSColor darkGrayColor],
NSBackgroundColorAttributeName: [NSColor whiteColor],
NSFontAttributeName: [NSFont fontWithName:@"Helvetica" size:(CGFloat)16],
} range: NSMakeRange(0, 14)];
[image lockFocus]; [image lockFocus];
[attrsText drawAtPoint: NSMakePoint(45, 8)]; [attrsText drawAtPoint: NSMakePoint(100, 5)];
[image unlockFocus]; [image unlockFocus];
} }
self.imageView.image = image; self.imageView.image = image;
@ -108,9 +103,9 @@
- (void)flagsChanged:(NSEvent *)event { - (void)flagsChanged:(NSEvent *)event {
NSUInteger modifiers = event.modifierFlags & NSDeviceIndependentModifierFlagsMask; NSUInteger modifiers = event.modifierFlags & NSDeviceIndependentModifierFlagsMask;
if (modifiers & NSAlternateKeyMask) { if (modifiers & NSAlternateKeyMask) {
[self setQRCode:self.legacyQRCode withOverlayText:@"Shadowsocks-NG Legacy"]; [self setQRCode:self.legacyQRCode withOverlayText:@"Legacy"];
} else { } else {
[self setQRCode:self.qrCode withOverlayText:@"Shadowsocks-NG SIP002"]; [self setQRCode:self.qrCode withOverlayText:@"SIP002"];
} }
} }