Ignore:
Timestamp:
Jan 18, 2019 4:29:12 PM (23 months ago)
Author:
meeh <meeh@…>
Branches:
master
Children:
a367778
Parents:
5212591
Message:

Mac OSX Launcher: UI code updates, integration of firefox manager.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • launchers/macosx/I2PLauncher/userinterface/RouterStatusView.swift

    r5212591 r605f987  
    1919  }
    2020 
     21  var isFirefoxEnabled = false
     22 
    2123  @IBOutlet var routerStatusLabel: NSTextField?
    2224  @IBOutlet var routerVersionLabel: NSTextField?
     
    2931  @IBOutlet var routerStartStopButton: NSButton?
    3032  @IBOutlet var openConsoleButton: NSButton?
     33  @IBOutlet var launchFirefoxButton: NSButton?
    3134 
    3235 
     
    7881  }
    7982 
     83  @objc func actionBtnLaunchFirefox(_ sender: Any?) {
     84    DispatchQueue.global(qos: .background).async {
     85      Swift.print("Starting firefox")
     86      FirefoxManager.shared().executeFirefox()
     87    }
     88  }
     89 
    8090  func restartFn() {
    8191    RouterManager.shared().routerRunner.StopAgent({
     
    117127  }
    118128 
     129  func setupFirefoxBtn() {
     130    DispatchQueue.global(qos: .background).async {
     131      if (FirefoxManager.shared().IsFirefoxFound() && !self.isFirefoxEnabled) {
     132        Swift.print("Enabling Firefox Launch Button")
     133        DispatchQueue.main.async {
     134          self.isFirefoxEnabled = true
     135          self.launchFirefoxButton?.isEnabled = true
     136          self.launchFirefoxButton?.isTransparent = false
     137          self.launchFirefoxButton?.needsDisplay = true
     138          self.launchFirefoxButton?.action = #selector(self.actionBtnLaunchFirefox(_:))
     139          self.launchFirefoxButton?.target = self
     140        }
     141      }
     142    }
     143  }
     144 
    119145  override func viewWillDraw() {
    120146    super.viewWillDraw()
     
    123149    }
    124150    self.reEnableButton()
    125     openConsoleButton!.cell!.action = #selector(self.actionBtnOpenConsole(_:))
    126     openConsoleButton!.cell!.target = self
     151    openConsoleButton?.cell?.action = #selector(self.actionBtnOpenConsole(_:))
     152    openConsoleButton?.cell?.target = self
    127153   
    128154  }
     
    198224    super.init(coder: c)!
    199225    self.setupObservers()
     226    self.setupFirefoxBtn()
    200227    self.toggleSetButtonStart()
    201228    self.reEnableButton()
     
    205232    super.init(coder: decoder)
    206233    self.setupObservers()
     234    self.setupFirefoxBtn()
    207235    self.toggleSetButtonStart()
    208236    self.reEnableButton()
Note: See TracChangeset for help on using the changeset viewer.