|
|
|
@ -4,10 +4,10 @@ import QuartzCore |
|
|
|
public enum HUDState { |
|
|
|
case hidden |
|
|
|
case recording(level: Float, isLagging: Bool = false, pingQuality: PingQuality? = nil) |
|
|
|
case retrying |
|
|
|
case retrying(reason: String = "RETRYING...") |
|
|
|
case transcribing |
|
|
|
case success |
|
|
|
case error |
|
|
|
case error(message: String = "ERROR") |
|
|
|
} |
|
|
|
|
|
|
|
public final class HUDOverlayController { |
|
|
|
@ -86,26 +86,36 @@ public final class HUDOverlayController { |
|
|
|
} |
|
|
|
orb.updateAudioLevel(level, isLagging: isLagging, pingQuality: pingQuality) |
|
|
|
|
|
|
|
case .retrying: |
|
|
|
case .retrying(let reason): |
|
|
|
if !self.isVisible || window.alphaValue < 0.95 { |
|
|
|
window.orderFrontRegardless() |
|
|
|
window.alphaValue = 1.0 |
|
|
|
self.isVisible = true |
|
|
|
} |
|
|
|
orb.showRetryState() |
|
|
|
orb.showRetryState(reason: reason) |
|
|
|
|
|
|
|
case .transcribing: |
|
|
|
if !self.isVisible || window.alphaValue < 0.95 { |
|
|
|
window.orderFrontRegardless() |
|
|
|
window.alphaValue = 1.0 |
|
|
|
self.isVisible = true |
|
|
|
} |
|
|
|
orb.showTranscribingState() |
|
|
|
|
|
|
|
case .success: |
|
|
|
orb.showSuccessState() |
|
|
|
DispatchQueue.main.asyncAfter(deadline: .now() + 0.20) { |
|
|
|
DispatchQueue.main.asyncAfter(deadline: .now() + 0.35) { |
|
|
|
self.hide() |
|
|
|
} |
|
|
|
|
|
|
|
case .error: |
|
|
|
orb.showErrorState() |
|
|
|
DispatchQueue.main.asyncAfter(deadline: .now() + 0.70) { |
|
|
|
case .error(let message): |
|
|
|
if !self.isVisible || window.alphaValue < 0.95 { |
|
|
|
window.orderFrontRegardless() |
|
|
|
window.alphaValue = 1.0 |
|
|
|
self.isVisible = true |
|
|
|
} |
|
|
|
orb.showErrorState(message: message) |
|
|
|
DispatchQueue.main.asyncAfter(deadline: .now() + 1.40) { |
|
|
|
self.hide() |
|
|
|
} |
|
|
|
} |
|
|
|
@ -263,10 +273,14 @@ final class OutwardExpandingOrbView: NSView { |
|
|
|
CATransaction.commit() |
|
|
|
} |
|
|
|
|
|
|
|
func showRetryState() { |
|
|
|
func showRetryState(reason: String = "RETRYING...") { |
|
|
|
CATransaction.begin() |
|
|
|
CATransaction.setDisableActions(false) |
|
|
|
CATransaction.setAnimationDuration(0.20) |
|
|
|
pingTextLayer.string = reason |
|
|
|
pingTextLayer.fontSize = reason.count > 8 ? 9.0 : 10.0 |
|
|
|
pingTextLayer.foregroundColor = NSColor(red: 0.25, green: 0.15, blue: 0.02, alpha: 0.95).cgColor |
|
|
|
coreSolidLayer.backgroundColor = NSColor(red: 1.0, green: 0.75, blue: 0.20, alpha: 1.0).cgColor |
|
|
|
let amber = NSColor(red: 1.0, green: 0.65, blue: 0.10, alpha: 1.0).cgColor |
|
|
|
let strokeWidth: CGFloat = 5.0 |
|
|
|
let strokeDiameter = baseDiameter + (strokeWidth * 2.0) |
|
|
|
@ -283,6 +297,10 @@ final class OutwardExpandingOrbView: NSView { |
|
|
|
func showTranscribingState() { |
|
|
|
CATransaction.begin() |
|
|
|
CATransaction.setDisableActions(true) |
|
|
|
pingTextLayer.string = "WAIT..." |
|
|
|
pingTextLayer.fontSize = 11.0 |
|
|
|
pingTextLayer.foregroundColor = NSColor.white.cgColor |
|
|
|
coreSolidLayer.backgroundColor = NSColor(red: 0.15, green: 0.20, blue: 0.30, alpha: 1.0).cgColor |
|
|
|
let strokeWidth: CGFloat = 3.5 |
|
|
|
let strokeDiameter = baseDiameter + (strokeWidth * 2.0) |
|
|
|
dynamicStrokeLayer.bounds = CGRect(x: 0, y: 0, width: strokeDiameter, height: strokeDiameter) |
|
|
|
@ -300,6 +318,10 @@ final class OutwardExpandingOrbView: NSView { |
|
|
|
CATransaction.begin() |
|
|
|
CATransaction.setDisableActions(false) |
|
|
|
CATransaction.setAnimationDuration(0.18) |
|
|
|
pingTextLayer.string = "OK" |
|
|
|
pingTextLayer.fontSize = 11.0 |
|
|
|
pingTextLayer.foregroundColor = NSColor(red: 0.04, green: 0.20, blue: 0.08, alpha: 0.95).cgColor |
|
|
|
coreSolidLayer.backgroundColor = NSColor(red: 0.22, green: 0.82, blue: 0.44, alpha: 1.0).cgColor |
|
|
|
let emerald = NSColor(red: 0.18, green: 0.85, blue: 0.38, alpha: 1.0).cgColor // Vibrant Emerald Green |
|
|
|
let strokeWidth: CGFloat = 6.0 |
|
|
|
let strokeDiameter = baseDiameter + (strokeWidth * 2.0) |
|
|
|
@ -313,10 +335,14 @@ final class OutwardExpandingOrbView: NSView { |
|
|
|
CATransaction.commit() |
|
|
|
} |
|
|
|
|
|
|
|
func showErrorState() { |
|
|
|
func showErrorState(message: String = "ERROR") { |
|
|
|
CATransaction.begin() |
|
|
|
CATransaction.setDisableActions(false) |
|
|
|
CATransaction.setAnimationDuration(0.18) |
|
|
|
pingTextLayer.string = message |
|
|
|
pingTextLayer.fontSize = message.count > 8 ? 9.0 : 10.0 |
|
|
|
pingTextLayer.foregroundColor = NSColor.white.cgColor |
|
|
|
coreSolidLayer.backgroundColor = NSColor(red: 0.94, green: 0.22, blue: 0.22, alpha: 1.0).cgColor |
|
|
|
let darkRed = NSColor(red: 0.95, green: 0.15, blue: 0.15, alpha: 1.0).cgColor |
|
|
|
let strokeWidth: CGFloat = 5.0 |
|
|
|
let strokeDiameter = baseDiameter + (strokeWidth * 2.0) |
|
|
|
|