masakih

OSXを起動したらそこには『艦隊これくしょん -艦これ-』の世界が広がっていたのです!?

  • R/O
  • HTTP
  • SSH
  • HTTPS

提交

Frequently used words (click to add to your profile)

javaandroidc++linuxc#objective-ccocoa誰得qtrubypythongamewindowsbathyscaphephpguic翻訳omegattwitterframeworktestbtronarduinovb.net計画中(planning stage)directxpreviewerゲームエンジンdom

Commit MetaInfo

修订版646b3d68cf4350de634ac4a309975d10f9041b82 (tree)
时间2018-04-18 22:28:50
作者masakih <masakih@user...>
Commitermasakih

Log Message

コーディング規約を変更した

更改概述

差异

--- a/KanColleBrowserForOSX.xcodeproj/project.pbxproj
+++ b/KanColleBrowserForOSX.xcodeproj/project.pbxproj
@@ -164,7 +164,7 @@
164164 F4EF18A71B4D36E60021BF8D /* Project object */ = {
165165 isa = PBXProject;
166166 attributes = {
167- LastUpgradeCheck = 0810;
167+ LastUpgradeCheck = 0930;
168168 ORGANIZATIONNAME = "Hori,Masaki";
169169 TargetAttributes = {
170170 F4EF18AE1B4D36E60021BF8D = {
@@ -285,14 +285,22 @@
285285 CLANG_CXX_LIBRARY = "libc++";
286286 CLANG_ENABLE_MODULES = YES;
287287 CLANG_ENABLE_OBJC_ARC = YES;
288+ CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
288289 CLANG_WARN_BOOL_CONVERSION = YES;
290+ CLANG_WARN_COMMA = YES;
289291 CLANG_WARN_CONSTANT_CONVERSION = YES;
292+ CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
290293 CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
291294 CLANG_WARN_EMPTY_BODY = YES;
292295 CLANG_WARN_ENUM_CONVERSION = YES;
293296 CLANG_WARN_INFINITE_RECURSION = YES;
294297 CLANG_WARN_INT_CONVERSION = YES;
298+ CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
299+ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
300+ CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
295301 CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
302+ CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
303+ CLANG_WARN_STRICT_PROTOTYPES = YES;
296304 CLANG_WARN_SUSPICIOUS_MOVE = YES;
297305 CLANG_WARN_UNREACHABLE_CODE = YES;
298306 CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
@@ -333,14 +341,22 @@
333341 CLANG_CXX_LIBRARY = "libc++";
334342 CLANG_ENABLE_MODULES = YES;
335343 CLANG_ENABLE_OBJC_ARC = YES;
344+ CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
336345 CLANG_WARN_BOOL_CONVERSION = YES;
346+ CLANG_WARN_COMMA = YES;
337347 CLANG_WARN_CONSTANT_CONVERSION = YES;
348+ CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
338349 CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
339350 CLANG_WARN_EMPTY_BODY = YES;
340351 CLANG_WARN_ENUM_CONVERSION = YES;
341352 CLANG_WARN_INFINITE_RECURSION = YES;
342353 CLANG_WARN_INT_CONVERSION = YES;
354+ CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
355+ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
356+ CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
343357 CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
358+ CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
359+ CLANG_WARN_STRICT_PROTOTYPES = YES;
344360 CLANG_WARN_SUSPICIOUS_MOVE = YES;
345361 CLANG_WARN_UNREACHABLE_CODE = YES;
346362 CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
--- a/KanColleBrowserForOSX/AppDelegate.swift
+++ b/KanColleBrowserForOSX/AppDelegate.swift
@@ -14,6 +14,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
1414 var mainWindowController: KCBFOMainWindowController!
1515
1616 func applicationDidFinishLaunching(_ aNotification: Notification) {
17+
1718 mainWindowController = KCBFOMainWindowController.makeInstance()
1819 mainWindowController.showWindow(nil)
1920 }
--- a/KanColleBrowserForOSX/KCBFOMainWindowController.swift
+++ b/KanColleBrowserForOSX/KCBFOMainWindowController.swift
@@ -19,11 +19,13 @@ class KCBFOMainWindowController: NSWindowController {
1919 let gamePageURL = "http://www.dmm.com/netgame/social/-/gadgets/=/app_id=854854/"
2020
2121 class func makeInstance() -> KCBFOMainWindowController {
22+
2223 return KCBFOMainWindowController(windowNibName: "KCBFOMainWindowController")
2324 }
2425
2526
2627 override func windowDidLoad() {
28+
2729 super.windowDidLoad()
2830
2931 let pref = WKPreferences()
@@ -40,7 +42,7 @@ class KCBFOMainWindowController: NSWindowController {
4042 let script = WKUserScript(source: js, injectionTime: .atDocumentEnd, forMainFrameOnly: false)
4143 config.userContentController.addUserScript(script)
4244
43- let frame = CGRect(x: 0, y: 0, width: 2000, height: 2_000)
45+ let frame = CGRect(x: 0, y: 0, width: 2_000, height: 2_000)
4446 webView = WKWebView(frame: frame, configuration: config)
4547 webView.navigationDelegate = self
4648
@@ -56,6 +58,7 @@ class KCBFOMainWindowController: NSWindowController {
5658 }
5759
5860 func loadURLString(urlString: String) {
61+
5962 guard let url = URL(string: urlString) else { return }
6063 let req = URLRequest(url: url)
6164 webView.load(req)
@@ -63,14 +66,18 @@ class KCBFOMainWindowController: NSWindowController {
6366
6467
6568 @IBAction func reloadContent(_ sender: AnyObject?) {
66- guard let _ = webView.url
67- else {
69+
70+ guard let _ = webView.url else {
71+
6872 loadURLString(urlString: gamePageURL)
73+
6974 return
7075 }
7176 // ゲームページでない場合はゲームページを表示する
7277 if let url = webView?.url, url.absoluteString != gamePageURL {
78+
7379 loadURLString(urlString: gamePageURL)
80+
7481 return
7582 }
7683
@@ -80,11 +87,13 @@ class KCBFOMainWindowController: NSWindowController {
8087
8188 }
8289 @IBAction func reloadAndRecache(_ sender: AnyObject?) {
90+
8391 URLCache.shared.removeAllCachedResponses()
8492 reloadContent(sender)
8593 }
8694
8795 func adjustFlash() {
96+
8897 clipView.scroll(to: flashTopLeft)
8998 }
9099
@@ -99,16 +108,21 @@ class KCBFOMainWindowController: NSWindowController {
99108 WebMenuItemTagReload]
100109
101110 func webView(_ sender: WebView!, contextMenuItemsForElement element: [AnyHashable: Any]!, defaultMenuItems: [AnyObject]!) -> [Any]! {
111+
102112 return defaultMenuItems.flatMap() {
113+
103114 if ignoreTags.contains($0.tag) {
115+
104116 return []
105117 }
118+
106119 return [$0]
107120 }
108121 }
109122 }
110123
111124 extension KCBFOMainWindowController: WKNavigationDelegate {
125+
112126 func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) {
113127
114128 webView.evaluateJavaScript(
@@ -128,6 +142,7 @@ extension KCBFOMainWindowController: WKNavigationDelegate {
128142 "dict;"]
129143 .reduce("", +)
130144 ) { (dict, error) in
145+
131146 error.map { print($0) }
132147
133148 guard let param = dict as? [String: Any] else {
@@ -146,10 +161,13 @@ extension KCBFOMainWindowController: WKNavigationDelegate {
146161 }
147162 guard let top = param["top"] as? Int,
148163 let left = param["left"] as? Int,
149- let width = param["width"] as? Int
150- else { return }
164+ let width = param["width"] as? Int else {
165+
166+ return
167+ }
151168
152169 DispatchQueue.main.async { [weak self] in
170+
153171 guard let `self` = self else { return }
154172
155173 self.flashTopLeft = NSPoint(x: CGFloat(left + (width - 800) / 2),