OSDN Git Service

課金用の簡易ブラウザをつけた
authormasakih <masakih@users.sourceforge.jp>
Sun, 23 Nov 2014 04:52:33 +0000 (13:52 +0900)
committermasakih <masakih@users.sourceforge.jp>
Sun, 23 Nov 2014 04:52:33 +0000 (13:52 +0900)
デバッグ時にしか表示されない

KCD.xcodeproj/project.pbxproj
KCD/Base.lproj/MainMenu.xib
KCD/HMAppDelegate.h
KCD/HMAppDelegate.m
KCD/HMExternalBrowserWindowController.h [new file with mode: 0644]
KCD/HMExternalBrowserWindowController.m [new file with mode: 0644]
KCD/HMExternalBrowserWindowController.xib [new file with mode: 0644]

index 3de4d05..4e33fb8 100644 (file)
@@ -73,6 +73,8 @@
                F4B1E30919C73B6A00805879 /* HMSuppliesView.m in Sources */ = {isa = PBXBuildFile; fileRef = F4B1E30619C73B6A00805879 /* HMSuppliesView.m */; };
                F4B1E30C19D1C06900805879 /* HMHokyuChargeCommand.m in Sources */ = {isa = PBXBuildFile; fileRef = F4B1E30B19D1C06900805879 /* HMHokyuChargeCommand.m */; };
                F4B1E30F19D1C9C400805879 /* HMApplySuppliesCommand.m in Sources */ = {isa = PBXBuildFile; fileRef = F4B1E30E19D1C9C400805879 /* HMApplySuppliesCommand.m */; };
+               F4B2A08F1A1F9C2100D2EF12 /* HMExternalBrowserWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = F4B2A08D1A1F9C2100D2EF12 /* HMExternalBrowserWindowController.m */; };
+               F4B2A0901A1F9C2100D2EF12 /* HMExternalBrowserWindowController.xib in Resources */ = {isa = PBXBuildFile; fileRef = F4B2A08E1A1F9C2100D2EF12 /* HMExternalBrowserWindowController.xib */; };
                F4B2D02B18F83A2F00542742 /* HMScreenshotWindowController.xib in Resources */ = {isa = PBXBuildFile; fileRef = F4B2D02D18F83A2F00542742 /* HMScreenshotWindowController.xib */; };
                F4B2D03118F83CBB00542742 /* HMDeckViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = F4B2D02F18F83CBB00542742 /* HMDeckViewController.m */; };
                F4B2D03318F83CC800542742 /* HMDeckViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = F4B2D03518F83CC800542742 /* HMDeckViewController.xib */; };
                F4B1E30B19D1C06900805879 /* HMHokyuChargeCommand.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HMHokyuChargeCommand.m; sourceTree = "<group>"; };
                F4B1E30D19D1C9C400805879 /* HMApplySuppliesCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HMApplySuppliesCommand.h; sourceTree = "<group>"; };
                F4B1E30E19D1C9C400805879 /* HMApplySuppliesCommand.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HMApplySuppliesCommand.m; sourceTree = "<group>"; };
+               F4B2A08C1A1F9C2100D2EF12 /* HMExternalBrowserWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HMExternalBrowserWindowController.h; sourceTree = "<group>"; };
+               F4B2A08D1A1F9C2100D2EF12 /* HMExternalBrowserWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HMExternalBrowserWindowController.m; sourceTree = "<group>"; };
+               F4B2A08E1A1F9C2100D2EF12 /* HMExternalBrowserWindowController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = HMExternalBrowserWindowController.xib; sourceTree = "<group>"; };
                F4B2D02C18F83A2F00542742 /* ja */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = ja; path = ja.lproj/HMScreenshotWindowController.xib; sourceTree = "<group>"; };
                F4B2D02E18F83CBB00542742 /* HMDeckViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HMDeckViewController.h; sourceTree = "<group>"; };
                F4B2D02F18F83CBB00542742 /* HMDeckViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HMDeckViewController.m; sourceTree = "<group>"; };
                                F4A2AF561A074DE40024BD9E /* HMScreenshotListWindowController.xib */,
                                F4A2AF591A0F9B490024BD9E /* HMScreenshotInformation.h */,
                                F4A2AF5A1A0F9B490024BD9E /* HMScreenshotInformation.m */,
+                               F4B2A08C1A1F9C2100D2EF12 /* HMExternalBrowserWindowController.h */,
+                               F4B2A08D1A1F9C2100D2EF12 /* HMExternalBrowserWindowController.m */,
+                               F4B2A08E1A1F9C2100D2EF12 /* HMExternalBrowserWindowController.xib */,
                        );
                        name = UI;
                        sourceTree = "<group>";
                                F4B3DC3318E5C8520011B4FC /* HMShipViewController.xib in Resources */,
                                F43E67B718BE02A10087E5B6 /* STypeShortName.plist in Resources */,
                                F4A2AF541A074DE40024BD9E /* HMScreenshotListWindowController.xib in Resources */,
+                               F4B2A0901A1F9C2100D2EF12 /* HMExternalBrowserWindowController.xib in Resources */,
                                F4BDEB5F187252F30069D0CE /* Images.xcassets in Resources */,
                                F4BEEE9F18D211280006F70C /* Localizable.strings in Resources */,
                                F4513EF018B96C6C00073552 /* Links.rtf in Resources */,
                                F4B3DC2E18E07B680011B4FC /* HMHistoryWindowController.m in Sources */,
                                F4C118FA18A67B1C005D5B25 /* CacheStoragePolicy.m in Sources */,
                                F4A3AD9219BDDD8E00FDBF80 /* HMPreferencePanelController.m in Sources */,
+                               F4B2A08F1A1F9C2100D2EF12 /* HMExternalBrowserWindowController.m in Sources */,
                                F4B3DC2118DECF570011B4FC /* HMTSVSupport.m in Sources */,
                                F4B1E30819C73B6A00805879 /* HMSuppliesCell.m in Sources */,
                                F4A3AD8E19BB220000FDBF80 /* HMMaskInfomation.m in Sources */,
index 7671d6f..6c49f5d 100644 (file)
@@ -260,6 +260,12 @@ CA
                                     <action selector="showHideScreenshotListWindow:" target="-1" id="Ynz-Sq-TRj"/>
                                 </connections>
                             </menuItem>
+                            <menuItem title="Billing Window" id="6D0-wS-chg">
+                                <modifierMask key="keyEquivalentModifierMask"/>
+                                <connections>
+                                    <action selector="showExternalBrowserWindow:" target="494" id="r5E-jo-i8w"/>
+                                </connections>
+                            </menuItem>
                         </items>
                     </menu>
                 </menuItem>
@@ -279,6 +285,7 @@ CA
         </menu>
         <customObject id="494" customClass="HMAppDelegate">
             <connections>
+                <outlet property="billingWindowMenuItem" destination="6D0-wS-chg" id="t7a-8y-tGR"/>
                 <outlet property="debugMenuItem" destination="TRC-ZR-9HP" id="7F5-QE-93s"/>
             </connections>
         </customObject>
index edc9977..e5b7ff3 100644 (file)
@@ -31,6 +31,7 @@ typedef NS_ENUM(NSUInteger, HMShipType) {
 - (NSPredicate *)predicateForShipType:(HMShipType)shipType;
 
 @property (strong, nonatomic) IBOutlet NSMenuItem *debugMenuItem;
+@property (nonatomic, weak) IBOutlet NSMenuItem *billingWindowMenuItem;
 
 @property (nonatomic, strong) NSString *screenShotSaveDirectory;
 @property (readonly) HMScreenshotListWindowController *screenshotListWindowController;
index 19e7383..1c8cc9e 100644 (file)
@@ -16,6 +16,7 @@
 #import "HMUpgradableShipsWindowController.h"
 #import "HMScreenshotListWindowController.h"
 
+#import "HMExternalBrowserWindowController.h"
 
 #import "HMTSVSupport.h"
 
@@ -36,6 +37,8 @@
 @property (strong) HMPreferencePanelController *preferencePanelController;
 @property (strong) HMUpgradableShipsWindowController *upgradableShipWindowController;
 
+@property (strong) HMExternalBrowserWindowController *externalBrowserWindowController;
+
 #ifdef DEBUG
 @property (strong) HMShipWindowController *shipWindowController;
 #endif
@@ -123,6 +126,7 @@ static FILE* logFileP = NULL;
 #endif
        if(!HMStandardDefaults.showsDebugMenu) {
                [self.debugMenuItem setHidden:YES];
+               [self.billingWindowMenuItem setHidden:YES];
        }
 }
 
@@ -241,6 +245,14 @@ static FILE* logFileP = NULL;
                        [menuItem setTitle:NSLocalizedString(@"Hide Screenshot List", @"")];
                }
                return YES;
+       } else if(action == @selector(showExternalBrowserWindow:)) {
+               NSWindow *window = self.externalBrowserWindowController.window;
+               if(!window.isVisible || !window.isMainWindow) {
+                       [menuItem setTitle:NSLocalizedString(@"Show Billing Window", @"")];
+               } else {
+                       [menuItem setTitle:NSLocalizedString(@"Hide Billing Window", @"")];
+               }
+               return YES;
        } else if(action == @selector(saveLocalData:) || action == @selector(loadLocalData:)) {
                return YES;
        } else if(action == @selector(showHidePreferencePanle:)) {
@@ -320,6 +332,20 @@ static FILE* logFileP = NULL;
        }
 }
 
+- (IBAction)showExternalBrowserWindow:(id)sender
+{
+       if(!self.externalBrowserWindowController) {
+               self.externalBrowserWindowController = [HMExternalBrowserWindowController new];
+       }
+       
+       NSWindow *window = self.externalBrowserWindowController.window;
+       if(!window.isVisible || !window.isMainWindow) {
+               [window makeKeyAndOrderFront:nil];
+       } else {
+               [window orderOut:nil];
+       }
+}
+
 #pragma mark - NSApplicationDelegate
 - (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)sender
 {
diff --git a/KCD/HMExternalBrowserWindowController.h b/KCD/HMExternalBrowserWindowController.h
new file mode 100644 (file)
index 0000000..9d19ddd
--- /dev/null
@@ -0,0 +1,22 @@
+//
+//  HMExternalBrowserWindowController.h
+//  KCD
+//
+//  Created by Hori,Masaki on 2014/11/22.
+//  Copyright (c) 2014年 Hori,Masaki. All rights reserved.
+//
+
+#import <Cocoa/Cocoa.h>
+
+#import <WebKit/WebKit.h>
+
+
+@interface HMExternalBrowserWindowController : NSWindowController
+
+
+@property (nonatomic, weak) IBOutlet WebView *webView;
+@property (nonatomic, weak) IBOutlet NSSegmentedControl *goSegment;
+
+- (IBAction)clickGoBackSegment:(id)sender;
+
+@end
diff --git a/KCD/HMExternalBrowserWindowController.m b/KCD/HMExternalBrowserWindowController.m
new file mode 100644 (file)
index 0000000..e378d0b
--- /dev/null
@@ -0,0 +1,86 @@
+//
+//  HMExternalBrowserWindowController.m
+//  KCD
+//
+//  Created by Hori,Masaki on 2014/11/22.
+//  Copyright (c) 2014年 Hori,Masaki. All rights reserved.
+//
+
+#import "HMExternalBrowserWindowController.h"
+
+@interface HMExternalBrowserWindowController ()
+
+@end
+
+@implementation HMExternalBrowserWindowController
+
+- (id)init
+{
+       self = [super initWithWindowNibName:NSStringFromClass([self class])];
+       return self;
+}
+
+- (void)awakeFromNib
+{
+       [self goHome:nil];
+       
+       [self.webView addObserver:self
+                                  forKeyPath:@"canGoBack"
+                                         options:0
+                                         context:(__bridge void *)(self.webView)];
+       [self.webView addObserver:self
+                                  forKeyPath:@"canGoForward"
+                                         options:0
+                                         context:(__bridge void *)(self.webView)];
+}
+
+- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
+{
+       id contextObject = (__bridge id)(context);
+       if(self.webView == contextObject) {
+               if([keyPath isEqualToString:@"canGoBack"]) {
+                       [self.goSegment setEnabled:self.webView.canGoBack forSegment:0];
+               }
+               if([keyPath isEqualToString:@"canGoForward"]) {
+                       [self.goSegment setEnabled:self.webView.canGoForward forSegment:1];
+               }
+               
+               
+               return;
+       }
+       
+       [super observeValueForKeyPath:keyPath ofObject:object change:change context:context];
+}
+
+/*
+ http://www.dmm.com/netgame/-/basket/
+ */
+
+- (IBAction)reloadContent:(id)sender
+{
+       [self.webView reload:self];
+}
+
+- (IBAction)goHome:(id)sender
+{
+       self.webView.mainFrameURL = @"http://www.dmm.com/netgame/-/basket/";
+}
+- (IBAction)clickGoBackSegment:(id)sender
+{
+       NSSegmentedCell *cell = self.goSegment.cell;
+       NSInteger tag = [cell tagForSegment:[cell selectedSegment]];
+       switch (tag) {
+               case 0:
+                       [self.webView goBack:self];
+                       break;
+               case 1:
+                       [self.webView goForward:self];
+                       break;
+               default:
+                       break;
+       }
+}
+@end
diff --git a/KCD/HMExternalBrowserWindowController.xib b/KCD/HMExternalBrowserWindowController.xib
new file mode 100644 (file)
index 0000000..6cc271d
--- /dev/null
@@ -0,0 +1,119 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="6250" systemVersion="13F34" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
+    <dependencies>
+        <deployment identifier="macosx"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="6250"/>
+        <plugIn identifier="com.apple.WebKitIBPlugin" version="6250"/>
+    </dependencies>
+    <objects>
+        <customObject id="-2" userLabel="File's Owner" customClass="HMExternalBrowserWindowController">
+            <connections>
+                <outlet property="goSegment" destination="TLp-GC-eT2" id="OZi-HB-8MM"/>
+                <outlet property="webView" destination="Vpq-H1-y1B" id="wm8-wa-ayH"/>
+                <outlet property="window" destination="F0z-JX-Cv5" id="gIp-Ho-8D9"/>
+            </connections>
+        </customObject>
+        <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
+        <customObject id="-3" userLabel="Application" customClass="NSObject"/>
+        <window title="Window" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" oneShot="NO" releasedWhenClosed="NO" animationBehavior="default" id="F0z-JX-Cv5">
+            <windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
+            <windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
+            <rect key="contentRect" x="196" y="240" width="850" height="631"/>
+            <rect key="screenRect" x="0.0" y="0.0" width="1440" height="900"/>
+            <view key="contentView" id="se5-gp-TjO">
+                <rect key="frame" x="0.0" y="-1" width="850" height="631"/>
+                <autoresizingMask key="autoresizingMask"/>
+                <subviews>
+                    <webView id="Vpq-H1-y1B">
+                        <rect key="frame" x="0.0" y="0.0" width="850" height="631"/>
+                        <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES"/>
+                        <webPreferences key="preferences" defaultFontSize="12" defaultFixedFontSize="12"/>
+                        <connections>
+                            <outlet property="UIDelegate" destination="-2" id="Qgz-H2-GJA"/>
+                        </connections>
+                    </webView>
+                </subviews>
+            </view>
+            <toolbar key="toolbar" implicitIdentifier="5B7CBCD4-15D6-41E0-B4FD-96F089B89683" autosavesConfiguration="NO" allowsUserCustomization="NO" displayMode="iconOnly" sizeMode="regular" id="SpO-Qb-h0u">
+                <allowedToolbarItems>
+                    <toolbarItem implicitItemIdentifier="D74BA0C4-BF39-447F-8B06-F4B1EF0BE5EC" label="Address" paletteLabel="Address" id="dk4-x0-fn2">
+                        <nil key="toolTip"/>
+                        <size key="minSize" width="200" height="22"/>
+                        <size key="maxSize" width="40000000" height="22"/>
+                        <textField key="view" verticalHuggingPriority="750" id="g1V-ng-7Ik">
+                            <rect key="frame" x="0.0" y="14" width="241" height="22"/>
+                            <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
+                            <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" drawsBackground="YES" id="Wm7-Gz-0Q2">
+                                <font key="font" metaFont="system"/>
+                                <color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
+                                <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                            </textFieldCell>
+                            <connections>
+                                <binding destination="Bwc-hB-eRh" name="value" keyPath="selection.mainFrameURL" id="vuh-9N-P9x"/>
+                            </connections>
+                        </textField>
+                    </toolbarItem>
+                    <toolbarItem implicitItemIdentifier="C8E49B13-1DFD-4FC0-8FB4-B65AB8673D2C" label="Navi" paletteLabel="Navi" id="yBb-7R-Qfc">
+                        <nil key="toolTip"/>
+                        <size key="minSize" width="51" height="25"/>
+                        <size key="maxSize" width="53" height="25"/>
+                        <segmentedControl key="view" verticalHuggingPriority="750" id="TLp-GC-eT2">
+                            <rect key="frame" x="14" y="14" width="51" height="25"/>
+                            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
+                            <segmentedCell key="cell" borderStyle="border" alignment="left" style="texturedSquare" trackingMode="momentary" id="g7f-xt-fZd">
+                                <font key="font" metaFont="system"/>
+                                <segments>
+                                    <segment image="NSGoLeftTemplate" width="24">
+                                        <nil key="label"/>
+                                    </segment>
+                                    <segment image="NSGoRightTemplate" width="24" tag="1">
+                                        <nil key="label"/>
+                                    </segment>
+                                </segments>
+                            </segmentedCell>
+                            <connections>
+                                <action selector="clickGoBackSegment:" target="-2" id="eIq-se-YwF"/>
+                            </connections>
+                        </segmentedControl>
+                    </toolbarItem>
+                    <toolbarItem implicitItemIdentifier="6550A6B2-0DD9-4DC6-BEE3-CB1A4CFC1A7C" label="Home" paletteLabel="Home" image="NSHomeTemplate" id="fQm-0j-yZH">
+                        <nil key="toolTip"/>
+                        <size key="minSize" width="34" height="25"/>
+                        <size key="maxSize" width="34" height="25"/>
+                        <button key="view" verticalHuggingPriority="750" id="2HZ-Ws-7pY">
+                            <rect key="frame" x="19" y="14" width="34" height="25"/>
+                            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
+                            <buttonCell key="cell" type="roundTextured" bezelStyle="texturedRounded" image="NSHomeTemplate" imagePosition="overlaps" alignment="center" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="RNx-lC-wD6">
+                                <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                <font key="font" metaFont="system"/>
+                            </buttonCell>
+                        </button>
+                        <connections>
+                            <action selector="goHome:" target="-2" id="7WE-aZ-0yM"/>
+                        </connections>
+                    </toolbarItem>
+                </allowedToolbarItems>
+                <defaultToolbarItems>
+                    <toolbarItem reference="yBb-7R-Qfc"/>
+                    <toolbarItem reference="fQm-0j-yZH"/>
+                    <toolbarItem reference="dk4-x0-fn2"/>
+                </defaultToolbarItems>
+            </toolbar>
+            <connections>
+                <binding destination="Bwc-hB-eRh" name="title" keyPath="selection.mainFrameTitle" id="9c0-go-DbU"/>
+                <outlet property="delegate" destination="-2" id="0bl-1N-AYu"/>
+            </connections>
+            <point key="canvasLocation" x="143" y="388.5"/>
+        </window>
+        <objectController objectClassName="WebView" id="Bwc-hB-eRh">
+            <connections>
+                <outlet property="content" destination="Vpq-H1-y1B" id="TIS-JD-71b"/>
+            </connections>
+        </objectController>
+    </objects>
+    <resources>
+        <image name="NSGoLeftTemplate" width="9" height="9"/>
+        <image name="NSGoRightTemplate" width="9" height="9"/>
+        <image name="NSHomeTemplate" width="14" height="13"/>
+    </resources>
+</document>