Changeset e3ab9f8e
- Timestamp:
- Oct 11, 2018 5:02:42 PM (3 years ago)
- Branches:
- master
- Children:
- 8e988c39
- Parents:
- 96d31995
- Location:
- launchers/macosx
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
launchers/macosx/I2PLauncher.xcodeproj/project.pbxproj
r96d31995 re3ab9f8e 19 19 BF1EFA48215141640014EB07 /* ItoopieTransparent.png in Resources */ = {isa = PBXBuildFile; fileRef = BF1EFA45215141640014EB07 /* ItoopieTransparent.png */; }; 20 20 BF3143FE2160C1BD0014EB07 /* DownloadJavaViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF3143FD2160C1BD0014EB07 /* DownloadJavaViewController.swift */; }; 21 BF4AA39F215AA58B0014EB07 /* NetworkExtension.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BF4AA39E215AA58B0014EB07 /* NetworkExtension.framework */; };22 21 BF5061702113C48E0014EB07 /* I2PLauncher.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = BF50616E2113C48E0014EB07 /* I2PLauncher.xcdatamodeld */; }; 23 22 BF5061722113C4900014EB07 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = BF5061712113C4900014EB07 /* Assets.xcassets */; }; … … 25 24 BF5061962113C84E0014EB07 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BF5061952113C84E0014EB07 /* Cocoa.framework */; }; 26 25 BF5315072150C55B0014EB07 /* RouterRunner.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF5315062150C55B0014EB07 /* RouterRunner.swift */; }; 27 BF53150B2150C6E80014EB07 /* I2PSubprocess.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF53150A2150C6E80014EB07 /* I2PSubprocess.swift */; };28 26 BF53150D2150CE310014EB07 /* DateTimeUtils.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF53150C2150CE310014EB07 /* DateTimeUtils.swift */; }; 29 27 BF5315132150EB510014EB07 /* RouterProcessStatus+ObjectiveC.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF5315122150EB510014EB07 /* RouterProcessStatus+ObjectiveC.swift */; }; 30 28 BF531515215105B40014EB07 /* LogViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF531514215105B40014EB07 /* LogViewController.swift */; }; 31 29 BF650CA92152AC7D0014EB07 /* bumpInfoPlist.sh in Resources */ = {isa = PBXBuildFile; fileRef = BF650CA52152AC7D0014EB07 /* bumpInfoPlist.sh */; }; 32 BF650CAB2152AC7D0014EB07 /* Deployer.m in Sources */ = {isa = PBXBuildFile; fileRef = BF650CA72152AC7D0014EB07 /* Deployer.m */; };30 BF650CAB2152AC7D0014EB07 /* Deployer.mm in Sources */ = {isa = PBXBuildFile; fileRef = BF650CA72152AC7D0014EB07 /* Deployer.mm */; }; 33 31 BF7506CB21509CFD0014EB07 /* RouterProcessStatus.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF7506CA21509CFD0014EB07 /* RouterProcessStatus.swift */; }; 34 32 BF86541321515CA00014EB07 /* launcher.jar in Resources */ = {isa = PBXBuildFile; fileRef = BF1EFA46215141640014EB07 /* launcher.jar */; }; … … 47 45 BFBDCB02215060190014EB07 /* DetectJava.swift in Sources */ = {isa = PBXBuildFile; fileRef = BFBDCB01215060190014EB07 /* DetectJava.swift */; }; 48 46 BFBDCB04215060970014EB07 /* StatusBarController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BFBDCB03215060970014EB07 /* StatusBarController.swift */; }; 47 BFD899432169EE9F0014EB07 /* LaunchAgent.swift in Sources */ = {isa = PBXBuildFile; fileRef = BFD899422169EE9F0014EB07 /* LaunchAgent.swift */; }; 48 BFD899452169EFE90014EB07 /* LaunchAgent+Status.swift in Sources */ = {isa = PBXBuildFile; fileRef = BFD899442169EFE90014EB07 /* LaunchAgent+Status.swift */; }; 49 BFD899472169F01B0014EB07 /* LaunchAgentManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = BFD899462169F01B0014EB07 /* LaunchAgentManager.swift */; }; 49 50 BFDD81DA2156B3E30014EB07 /* RouterManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = BFDD81D92156B3E30014EB07 /* RouterManager.swift */; }; 50 51 BFE16BF82156C61E0014EB07 /* RouterStatusView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BFE16BF72156C61E0014EB07 /* RouterStatusView.swift */; }; 51 52 BFE16BFA2156DAED0014EB07 /* EventManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = BFE16BF92156DAED0014EB07 /* EventManager.swift */; }; 52 BFE16BFE2156FD2A0014EB07 /* Sparkle.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BFE16BFD2156FD290014EB07 /* Sparkle.framework */; };53 BFE16C002156FD9E0014EB07 /* Sparkle.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = BFE16BFD2156FD290014EB07 /* Sparkle.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };54 53 BFE1CBAD2151908F0014EB07 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BFE1CBAC2151908F0014EB07 /* CoreFoundation.framework */; }; 55 54 /* End PBXBuildFile section */ 56 57 /* Begin PBXCopyFilesBuildPhase section */58 BFE16BFF2156FD890014EB07 /* CopyFiles */ = {59 isa = PBXCopyFilesBuildPhase;60 buildActionMask = 2147483647;61 dstPath = "";62 dstSubfolderSpec = 10;63 files = (64 BFE16C002156FD9E0014EB07 /* Sparkle.framework in CopyFiles */,65 );66 runOnlyForDeploymentPostprocessing = 0;67 };68 /* End PBXCopyFilesBuildPhase section */69 55 70 56 /* Begin PBXFileReference section */ … … 89 75 BF3143FD2160C1BD0014EB07 /* DownloadJavaViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DownloadJavaViewController.swift; sourceTree = "<group>"; }; 90 76 BF3143FF2160CA350014EB07 /* logger_c.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = logger_c.h; sourceTree = "<group>"; }; 91 BF4AA39E215AA58B0014EB07 /* NetworkExtension.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = NetworkExtension.framework; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/NetworkExtension.framework; sourceTree = DEVELOPER_DIR; };92 77 BF5061682113C48E0014EB07 /* I2PLauncher.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = I2PLauncher.app; sourceTree = BUILT_PRODUCTS_DIR; }; 93 78 BF50616F2113C48E0014EB07 /* I2PLauncher.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = I2PLauncher.xcdatamodel; sourceTree = "<group>"; }; … … 98 83 BF5061952113C84E0014EB07 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; }; 99 84 BF5315062150C55B0014EB07 /* RouterRunner.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RouterRunner.swift; sourceTree = "<group>"; }; 100 BF53150A2150C6E80014EB07 /* I2PSubprocess.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = I2PSubprocess.swift; sourceTree = "<group>"; };101 85 BF53150C2150CE310014EB07 /* DateTimeUtils.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DateTimeUtils.swift; sourceTree = "<group>"; }; 102 86 BF5315122150EB510014EB07 /* RouterProcessStatus+ObjectiveC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "RouterProcessStatus+ObjectiveC.swift"; sourceTree = "<group>"; }; 103 87 BF531514215105B40014EB07 /* LogViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LogViewController.swift; sourceTree = "<group>"; }; 104 88 BF650CA52152AC7D0014EB07 /* bumpInfoPlist.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = bumpInfoPlist.sh; sourceTree = SOURCE_ROOT; }; 105 BF650CA72152AC7D0014EB07 /* Deployer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Deployer.m; sourceTree = SOURCE_ROOT; };89 BF650CA72152AC7D0014EB07 /* Deployer.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = Deployer.mm; sourceTree = SOURCE_ROOT; }; 106 90 BF650CA82152AC7D0014EB07 /* Deployer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Deployer.h; sourceTree = SOURCE_ROOT; }; 107 91 BF7506CA21509CFD0014EB07 /* RouterProcessStatus.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RouterProcessStatus.swift; sourceTree = "<group>"; }; … … 122 106 BFBDCB01215060190014EB07 /* DetectJava.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetectJava.swift; sourceTree = "<group>"; }; 123 107 BFBDCB03215060970014EB07 /* StatusBarController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StatusBarController.swift; sourceTree = "<group>"; }; 108 BFD899422169EE9F0014EB07 /* LaunchAgent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LaunchAgent.swift; sourceTree = "<group>"; }; 109 BFD899442169EFE90014EB07 /* LaunchAgent+Status.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "LaunchAgent+Status.swift"; sourceTree = "<group>"; }; 110 BFD899462169F01B0014EB07 /* LaunchAgentManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LaunchAgentManager.swift; sourceTree = "<group>"; }; 124 111 BFDD81D92156B3E30014EB07 /* RouterManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RouterManager.swift; sourceTree = "<group>"; }; 125 112 BFE16BF72156C61E0014EB07 /* RouterStatusView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RouterStatusView.swift; sourceTree = "<group>"; }; … … 136 123 files = ( 137 124 BFE1CBAD2151908F0014EB07 /* CoreFoundation.framework in Frameworks */, 138 BF4AA39F215AA58B0014EB07 /* NetworkExtension.framework in Frameworks */,139 125 BF865417215182820014EB07 /* Foundation.framework in Frameworks */, 140 BFE16BFE2156FD2A0014EB07 /* Sparkle.framework in Frameworks */,141 126 BFBDCB0021505BEE0014EB07 /* AppKit.framework in Frameworks */, 142 127 BF5061962113C84E0014EB07 /* Cocoa.framework in Frameworks */, … … 203 188 BF650CA52152AC7D0014EB07 /* bumpInfoPlist.sh */, 204 189 BF650CA82152AC7D0014EB07 /* Deployer.h */, 205 BF650CA72152AC7D0014EB07 /* Deployer.m */,190 BF650CA72152AC7D0014EB07 /* Deployer.mm */, 206 191 BF1EFA42215141220014EB07 /* include */, 207 192 BF1EFA3F215141110014EB07 /* AppDelegate.h */, … … 231 216 isa = PBXGroup; 232 217 children = ( 233 BF4AA39E215AA58B0014EB07 /* NetworkExtension.framework */,234 218 BFE16BFD2156FD290014EB07 /* Sparkle.framework */, 235 219 BFE1CBAC2151908F0014EB07 /* CoreFoundation.framework */, … … 249 233 BF5315122150EB510014EB07 /* RouterProcessStatus+ObjectiveC.swift */, 250 234 BF5315062150C55B0014EB07 /* RouterRunner.swift */, 251 BF53150A2150C6E80014EB07 /* I2PSubprocess.swift */,252 235 BFDD81D92156B3E30014EB07 /* RouterManager.swift */, 253 236 ); … … 264 247 BFE16BF92156DAED0014EB07 /* EventManager.swift */, 265 248 BF14B711215D9E040014EB07 /* FolderContentMonitor.swift */, 249 BFD899422169EE9F0014EB07 /* LaunchAgent.swift */, 250 BFD899442169EFE90014EB07 /* LaunchAgent+Status.swift */, 251 BFD899462169F01B0014EB07 /* LaunchAgentManager.swift */, 266 252 ); 267 253 path = Utils; … … 280 266 BF1EFA4B215142030014EB07 /* ShellScript */, 281 267 BF5061662113C48E0014EB07 /* Resources */, 282 BFE16BFF2156FD890014EB07 /* CopyFiles */,283 268 ); 284 269 buildRules = ( … … 304 289 DevelopmentTeam = W3C42P2LA8; 305 290 LastSwiftMigration = 0940; 306 ProvisioningStyle = Automatic;291 ProvisioningStyle = Manual; 307 292 SystemCapabilities = { 308 293 com.apple.ApplicationGroups.Mac = { … … 313 298 }; 314 299 com.apple.NetworkExtensions = { 315 enabled = 1;300 enabled = 0; 316 301 }; 317 302 com.apple.Sandbox = { … … 386 371 runOnlyForDeploymentPostprocessing = 0; 387 372 shellPath = /bin/sh; 388 shellScript = "# Run from launchers/macosx\nset -x\n\n# Warning to keep clean files\nfind \"${SRCROOT}\" \\( -name \"*.h\" -or -name \"*.m\" \\) -print0 | xargs -0 wc -l | awk '$1 > 200 && $2 != \"total\" { print $2 \":1: warning: file more than 200 lines\" }'\n\n export BUILDDIR=$(pwd)\nexport MACOSX_SOURCE_DIR=$SRCROOT\nexport I2P_SOURCE_DIR=$(realpath $SRCROOT/../..)\ncd $MACOSX_SOURCE_DIR/..\n# TODO: Find out why sbt hangs when executed in cli\n#./sbt \";macosx:assembly\"\ncd ..\ncd $I2P_SOURCE_DIR\nant preppkg-osx\ncd pkg-temp\nrm -f $BUILDDIR/base.zip\nzip -r -v -9 $BUILDDIR/base.zip *\ncd $MACOSX_SOURCE_DIR\ncp $MACOSX_SOURCE_DIR/target/scala-2.11/routerLauncher-assembly-0.1.0-SNAPSHOT.jar $BUILDDIR/launcher.jar\n\n\n";373 shellScript = "# Run from launchers/macosx\nset -x\n\n# Warning to keep clean files\nfind \"${SRCROOT}\" \\( -name \"*.h\" -or -name \"*.m\" \\) -print0 | xargs -0 wc -l | awk '$1 > 200 && $2 != \"total\" { print $2 \":1: warning: file more than 200 lines\" }'\n\nif [ ! -z \"${REPACK_I2P}\" ]; then\n export BUILDDIR=$(pwd)\n export MACOSX_SOURCE_DIR=$SRCROOT\n export I2P_SOURCE_DIR=$(realpath $SRCROOT/../..)\n cd $MACOSX_SOURCE_DIR/..\n # TODO: Find out why sbt hangs when executed in cli\n #./sbt \";macosx:assembly\"\n cd ..\n cd $I2P_SOURCE_DIR\n ant preppkg-osx jbigi-osx-only\n cp build/jbigi.jar pkg-temp/lib/jbigi.jar\n cd pkg-temp\n rm -f $BUILDDIR/base.zip\n zip -r -v -9 $BUILDDIR/base.zip *\n cd $MACOSX_SOURCE_DIR\n cp $MACOSX_SOURCE_DIR/target/scala-2.11/routerLauncher-assembly-0.1.0-SNAPSHOT.jar $BUILDDIR/launcher.jar\nfi\n\n"; 389 374 }; 390 375 /* End PBXShellScriptBuildPhase section */ … … 409 394 BFBDCB02215060190014EB07 /* DetectJava.swift in Sources */, 410 395 BF07789E21506D2B0014EB07 /* PopoverViewController.swift in Sources */, 411 BF650CAB2152AC7D0014EB07 /* Deployer.m in Sources */, 396 BFD899472169F01B0014EB07 /* LaunchAgentManager.swift in Sources */, 397 BF650CAB2152AC7D0014EB07 /* Deployer.mm in Sources */, 412 398 BF1EFA40215141110014EB07 /* main.mm in Sources */, 413 399 BFBDCAF4215042670014EB07 /* AppleStuffExceptionHandler.m in Sources */, … … 415 401 BF531515215105B40014EB07 /* LogViewController.swift in Sources */, 416 402 BF5315132150EB510014EB07 /* RouterProcessStatus+ObjectiveC.swift in Sources */, 403 BFD899452169EFE90014EB07 /* LaunchAgent+Status.swift in Sources */, 417 404 BF14B712215D9E040014EB07 /* FolderContentMonitor.swift in Sources */, 418 405 BFBDCAFE2150567D0014EB07 /* SwiftMainDelegate.swift in Sources */, 406 BFD899432169EE9F0014EB07 /* LaunchAgent.swift in Sources */, 419 407 BFDD81DA2156B3E30014EB07 /* RouterManager.swift in Sources */, 420 BF53150B2150C6E80014EB07 /* I2PSubprocess.swift in Sources */,421 408 BF1EFA3A215140E60014EB07 /* SBridge.mm in Sources */, 422 409 BF14B70F215C98DC0014EB07 /* LoggerWorker.cpp in Sources */, … … 558 545 ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 559 546 CODE_SIGN_ENTITLEMENTS = I2PLauncher/I2PLauncher.entitlements; 560 CODE_SIGN_IDENTITY = " Mac Developer";561 CODE_SIGN_STYLE = Automatic;547 CODE_SIGN_IDENTITY = "Developer ID Application"; 548 CODE_SIGN_STYLE = Manual; 562 549 COMBINE_HIDPI_IMAGES = YES; 550 COMPRESS_PNG_FILES = YES; 563 551 COPY_PHASE_STRIP = YES; 564 552 DEAD_CODE_STRIPPING = YES; … … 571 559 "$(PROJECT_DIR)", 572 560 ); 573 HEADER_SEARCH_PATHS = "$(SRCROOT)/include"; 561 HEADER_SEARCH_PATHS = ( 562 "$(SRCROOT)/include", 563 "$(SRCROOT)/../../../Sparkle/Sparkle", 564 ); 574 565 INCLUDED_RECURSIVE_SEARCH_PATH_SUBDIRECTORIES = include; 575 566 INFOPLIST_FILE = I2PLauncher/Info.plist; … … 577 568 LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @executable_path/Frameworks @loader_path/../Frameworks"; 578 569 MACOSX_DEPLOYMENT_TARGET = 10.11; 579 PRODUCT_BUNDLE_IDENTIFIER = net.i2p.bootstrap.macosx.I2PLauncher;570 PRODUCT_BUNDLE_IDENTIFIER = "net.i2p.bootstrap-macosx.I2PLauncher"; 580 571 PRODUCT_NAME = "$(TARGET_NAME)"; 581 PROVISIONING_PROFILE = "";582 572 PROVISIONING_PROFILE_SPECIFIER = ""; 583 573 SDKROOT = macosx; … … 594 584 ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 595 585 CODE_SIGN_ENTITLEMENTS = I2PLauncher/I2PLauncher.entitlements; 596 CODE_SIGN_IDENTITY = " Mac Developer";597 CODE_SIGN_STYLE = Automatic;586 CODE_SIGN_IDENTITY = "Developer ID Application"; 587 CODE_SIGN_STYLE = Manual; 598 588 COMBINE_HIDPI_IMAGES = YES; 589 COMPRESS_PNG_FILES = YES; 599 590 COPY_PHASE_STRIP = YES; 600 591 DEAD_CODE_STRIPPING = YES; … … 607 598 "$(PROJECT_DIR)", 608 599 ); 609 HEADER_SEARCH_PATHS = "$(SRCROOT)/include"; 600 HEADER_SEARCH_PATHS = ( 601 "$(SRCROOT)/include", 602 "$(SRCROOT)/../../../Sparkle/Sparkle", 603 ); 610 604 INCLUDED_RECURSIVE_SEARCH_PATH_SUBDIRECTORIES = include; 611 605 INFOPLIST_FILE = I2PLauncher/Info.plist; … … 613 607 LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @executable_path/Frameworks @loader_path/../Frameworks"; 614 608 MACOSX_DEPLOYMENT_TARGET = 10.11; 615 PRODUCT_BUNDLE_IDENTIFIER = net.i2p.bootstrap.macosx.I2PLauncher;609 PRODUCT_BUNDLE_IDENTIFIER = "net.i2p.bootstrap-macosx.I2PLauncher"; 616 610 PRODUCT_NAME = "$(TARGET_NAME)"; 617 611 PROVISIONING_PROFILE_SPECIFIER = ""; -
launchers/macosx/I2PLauncher/userinterface/PopoverViewController.swift
r96d31995 re3ab9f8e 10 10 11 11 class PopoverViewController: NSViewController { 12 13 @IBOutlet var routerStatusViewOutlet: RouterStatusView? 14 15 func getRouterStatusView() -> RouterStatusView? { 16 return self.routerStatusViewOutlet 17 } 12 18 13 19 required init?(coder: NSCoder) { -
launchers/macosx/I2PLauncher/userinterface/RouterStatusView.swift
r96d31995 re3ab9f8e 23 23 @IBOutlet var routerStartedByLabel: NSTextField? 24 24 @IBOutlet var routerUptimeLabel: NSTextField? 25 @IBOutlet var routerPIDLabel: NSTextField? 25 26 26 27 @IBOutlet var quickControlView: NSView? 27 28 @IBOutlet var routerStartStopButton: NSButton? 29 @IBOutlet var openConsoleButton: NSButton? 28 30 29 31 @objc func actionBtnStartRouter(_ sender: Any?) { 30 32 NSLog("START ROUTER") 31 if (RouterManager.shared().getRouterTask() == nil) { 32 SBridge.sharedInstance().startupI2PRouter(RouterProcessStatus.i2pDirectoryPath, javaBinPath: RouterProcessStatus.knownJavaBinPath!) 33 /*if (RouterManager.shared().getRouterTask() == nil) { 34 SBridge.sharedInstance().startupI2PRouter(RouterProcessStatus.i2pDirectoryPath) 35 }*/ 36 (sender as! NSButton).isTransparent = true 37 let routerStatus = RouterRunner.launchAgent?.status() 38 switch routerStatus { 39 case .loaded?: 40 RouterManager.shared().routerRunner.StartAgent(information: RouterRunner.launchAgent) 41 case .unloaded?: 42 do { 43 try LaunchAgentManager.shared.load(RouterRunner.launchAgent!) 44 RouterManager.shared().routerRunner.StartAgent(information: RouterRunner.launchAgent) 45 } catch { 46 RouterManager.shared().eventManager.trigger(eventName: "router_exception", information: error) 47 } 48 break 49 default: 50 break 33 51 } 34 RouterManager.shared().updateState()52 self.reEnableButton() 35 53 } 36 54 37 55 @objc func actionBtnStopRouter(_ sender: Any?) { 38 56 NSLog("STOP ROUTER") 39 if (RouterManager.shared().getRouterTask() != nil) { 57 let routerStatus = RouterRunner.launchAgent?.status() 58 switch routerStatus { 59 case .running?: 40 60 NSLog("Found running router") 41 RouterManager.shared().getRouterTask()?.requestShutdown() 42 RouterManager.shared().updateState() 61 RouterManager.shared().routerRunner.StopAgent() 62 break 63 default: 64 break 43 65 } 66 self.reEnableButton() 44 67 } 45 68 46 69 @objc func actionBtnRestartRouter(sender: Any?) { 47 70 if (RouterManager.shared().getRouterTask() != nil) { 48 RouterManager.shared().getRouterTask()?.requestRestart()71 //RouterManager.shared().getRouterTask()?.requestRestart() 49 72 } else { 50 73 NSLog("Can't restart a non running router, start it however...") 51 SBridge.sharedInstance().startupI2PRouter(RouterProcessStatus.i2pDirectoryPath, javaBinPath: RouterProcessStatus.knownJavaBinPath!)74 //SBridge.sharedInstance().startupI2PRouter(RouterProcessStatus.i2pDirectoryPath) 52 75 } 53 RouterManager.shared().updateState()54 76 } 55 77 78 func handlerRouterStart(information:Any?) { 79 print("Triggered handlerRouterStart") 80 NSLog("PID2! %@", information as! String) 81 routerPIDLabel?.cell?.stringValue = "Router PID: "+(information as! String) 82 routerPIDLabel?.needsDisplay = true 83 routerStatusLabel?.cell?.stringValue = "Router status: Running" 84 self.toggleSetButtonStop() 85 self.reEnableButton() 86 } 56 87 88 func reEnableButton() { 89 let currentStatus : AgentStatus = RouterRunner.launchAgent?.status() ?? AgentStatus.unloaded 90 if currentStatus != AgentStatus.loaded && currentStatus != AgentStatus.unloaded { 91 self.toggleSetButtonStop() 92 } else { 93 self.toggleSetButtonStart() 94 } 95 routerStartStopButton?.isTransparent = false 96 routerStartStopButton?.needsDisplay = true 97 self.setRouterStatusLabelText() 98 } 99 100 func setupObservers() { 101 RouterManager.shared().eventManager.listenTo(eventName: "router_start", action: handlerRouterStart) 102 RouterManager.shared().eventManager.listenTo(eventName: "router_stop", action: handleRouterStop) 103 RouterManager.shared().eventManager.listenTo(eventName: "router_pid", action: handlerRouterStart) 104 RouterManager.shared().eventManager.listenTo(eventName: "launch_agent_running", action: reEnableButton) 105 RouterManager.shared().eventManager.listenTo(eventName: "launch_agent_unloaded", action: reEnableButton) 106 RouterManager.shared().eventManager.listenTo(eventName: "launch_agent_loaded", action: reEnableButton) 107 } 57 108 58 109 override func viewWillDraw() { … … 61 112 RouterStatusView.instance = self 62 113 } 63 self.setRouterStatusLabelText() 114 self.reEnableButton() 115 } 116 117 func handleRouterStop() { 118 routerPIDLabel?.cell?.stringValue = "Router PID: Not running" 119 self.toggleSetButtonStart() 120 reEnableButton() 121 } 122 123 private func toggleSetButtonStart() { 124 routerStatusLabel?.cell?.stringValue = "Router status: Not running" 125 routerStartStopButton?.title = "Start Router" 126 routerStartStopButton?.action = #selector(self.actionBtnStartRouter(_:)) 127 } 128 129 private func toggleSetButtonStop() { 130 routerStatusLabel?.cell?.stringValue = "Router status: Running" 131 routerStartStopButton?.title = "Stop Router" 132 routerStartStopButton?.action = #selector(self.actionBtnStopRouter(_:)) 64 133 } 65 134 66 135 func setRouterStatusLabelText() { 67 if (RouterProcessStatus.isRouterRunning) {68 routerStatusLabel?.cell?.stringValue = "Router status: Running"69 routerStartStopButton?.title = "Stop Router"70 routerStartStopButton?.action = #selector(self.actionBtnStopRouter(_:))71 } else {72 routerStatusLabel?.cell?.stringValue = "Router status: Not running"73 routerStartStopButton?.title = "Start Router"74 routerStartStopButton?.action = #selector(self.actionBtnStartRouter(_:))75 }76 136 routerStartStopButton?.needsDisplay = true 77 137 routerStartStopButton?.target = self 78 138 quickControlView?.needsDisplay = true 139 140 do { 141 let currentStatus : AgentStatus = RouterRunner.launchAgent!.status() 142 if currentStatus == AgentStatus.loaded || currentStatus == AgentStatus.unloaded { 143 routerStatusLabel?.cell?.stringValue = "Router status: Not running" 144 } else { 145 routerStatusLabel?.cell?.stringValue = "Router status: Running" 146 } 147 } catch { 148 // Ensure it's set even AgentStatus is nil (uninitialized yet..) 149 routerStatusLabel?.cell?.stringValue = "Router status: Not running" 150 } 79 151 80 152 let staticStartedByLabelText = "Router started by launcher?" … … 103 175 let c = NSCoder() 104 176 super.init(coder: c)! 105 self.setRouterStatusLabelText() 177 self.setupObservers() 178 self.toggleSetButtonStart() 179 self.reEnableButton() 106 180 } 107 181 108 182 required init?(coder decoder: NSCoder) { 109 183 super.init(coder: decoder) 110 self.setRouterStatusLabelText() 184 self.setupObservers() 185 self.toggleSetButtonStart() 186 self.reEnableButton() 111 187 } 112 188 -
launchers/macosx/I2PLauncher/userinterface/StatusBarController.swift
r96d31995 re3ab9f8e 16 16 let storyboard = NSStoryboard(name: "Storyboard", bundle: Bundle.main) 17 17 18 var updateObjectRef : SUUpdater? 18 var ctrl : PopoverViewController? 19 20 @IBOutlet var routerStatusTabView: RouterStatusView? 21 22 //var updateObjectRef : SUUpdater? 19 23 20 24 @objc func handleOpenConsole(_ sender: Any?) { … … 25 29 let menu = NSMenu() 26 30 27 let updateMenuItem = NSMenuItem(title: "Check for updates", action: #selector(self.updateObjectRef?.checkForUpdates(_:)), keyEquivalent: "U")31 /*let updateMenuItem = NSMenuItem(title: "Check for updates", action: #selector(self.updateObjectRef?.checkForUpdates(_:)), keyEquivalent: "U") 28 32 updateMenuItem.isEnabled = true 29 33 */ 30 34 menu.addItem(NSMenuItem(title: "Open I2P Console", action: #selector(self.handleOpenConsole(_:)), keyEquivalent: "O")) 31 35 menu.addItem(NSMenuItem.separator()) 32 menu.addItem(updateMenuItem)36 //menu.addItem(updateMenuItem) 33 37 menu.addItem(NSMenuItem.separator()) 34 38 menu.addItem(NSMenuItem(title: "Quit I2P Launcher", action: #selector(SwiftMainDelegate.terminate(_:)), keyEquivalent: "q")) … … 36 40 return menu 37 41 } 42 43 func pidReaction(information:Any?){ 44 let pidStr = information as! String 45 NSLog("PID! %@", pidStr) 46 showPopover(sender: nil) 47 //self.ctrl?.getRouterStatusView()?.handlerRouterStart(information: pidStr) 48 self.ctrl?.getRouterStatusView()?.needsDisplay = true 49 } 38 50 39 51 40 52 override init() { 41 53 super.init() 42 popover.contentViewController = PopoverViewController.freshController() 43 updateObjectRef = SUUpdater.shared() 44 updateObjectRef?.checkForUpdatesInBackground() 54 self.ctrl = PopoverViewController.freshController() 55 popover.contentViewController = self.ctrl 56 //updateObjectRef = SUUpdater.shared() 57 //updateObjectRef?.checkForUpdatesInBackground() 58 RouterManager.shared().eventManager.listenTo(eventName: "router_pid", action: pidReaction) 45 59 46 60 … … 101 115 closePopover(sender: sender) 102 116 } else { 103 RouterManager.shared().updateState()104 117 showPopover(sender: sender) 105 118 }
Note: See TracChangeset
for help on using the changeset viewer.