feat: added activity chart per disk to the Disk popup (#827)

This commit is contained in:
Serhiy Mytrovtsiy
2022-06-10 20:29:35 +02:00
parent 8071a06896
commit 2e0b57118b
5 changed files with 218 additions and 156 deletions

View File

@@ -14,7 +14,7 @@ import Kit
internal class Popup: NSStackView, Popup_p {
public var sizeCallback: ((NSSize) -> Void)? = nil
private let emptyView: EmptyView = EmptyView(height: 30, isHidden: false)
private let emptyView: EmptyView = EmptyView(height: 30, isHidden: false, msg: localizedString("No Bluetooth devices are available"))
public init() {
super.init(frame: NSRect(x: 0, y: 0, width: Constants.Popup.width, height: 30))

View File

@@ -16,7 +16,7 @@ internal class Settings: NSStackView, Settings_v {
public var callback: (() -> Void) = {}
private var list: [String: Bool] = [:]
private let emptyView: EmptyView = EmptyView()
private let emptyView: EmptyView = EmptyView(msg: localizedString("No Bluetooth devices are available"))
public init() {
super.init(frame: NSRect(x: 0, y: 0, width: 0, height: 0))
@@ -84,32 +84,3 @@ internal class Settings: NSStackView, Settings_v {
self.callback()
}
}
internal class EmptyView: NSStackView {
public init(height: CGFloat = 120, isHidden: Bool = false) {
super.init(frame: NSRect())
self.heightAnchor.constraint(equalToConstant: height).isActive = true
self.translatesAutoresizingMaskIntoConstraints = true
self.orientation = .vertical
self.distribution = .fillEqually
self.isHidden = isHidden
self.identifier = NSUserInterfaceItemIdentifier(rawValue: "emptyView")
let textView: NSTextView = NSTextView()
textView.heightAnchor.constraint(equalToConstant: (height/2)+6).isActive = true
textView.alignment = .center
textView.isEditable = false
textView.isSelectable = false
textView.drawsBackground = false
textView.string = localizedString("No Bluetooth devices are available")
self.addArrangedSubview(NSView())
self.addArrangedSubview(textView)
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}