Show qrcode for current server.

This commit is contained in:
Charlie Qiu
2016-06-09 06:59:42 +08:00
parent 33a093950e
commit 250dfc7b38
18 changed files with 249 additions and 59 deletions

View File

@ -0,0 +1,35 @@
//
// QRCodeWindowController.m
// shadowsocks
//
// Created by clowwindy on 10/12/14.
// Copyright (c) 2014 clowwindy. All rights reserved.
//
#import "SWBQRCodeWindowController.h"
@interface SWBQRCodeWindowController ()
@end
@implementation SWBQRCodeWindowController
- (void)windowDidLoad {
[super windowDidLoad];
// Implement this method to handle any initialization after your window controller's window has been loaded from its nib file.
[self.webView.mainFrame loadRequest:[NSURLRequest requestWithURL:[[NSBundle mainBundle] URLForResource:@"qrcode" withExtension:@"htm"]]];
self.webView.frameLoadDelegate = self;
}
-(void)webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)frame {
if (self.qrCode) {
[self.webView stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:@"genCode('%@')", _qrCode]];
}
}
-(void)dealloc {
self.webView.frameLoadDelegate = nil;
}
@end