mirror of
https://github.com/morgan9e/macos-stats
synced 2026-04-14 00:04:15 +09:00
feat: changed minimum macOS version to macOS 11.15 (Big Sur)
This commit is contained in:
@@ -347,9 +347,7 @@ private class OrderTableView: NSView, NSTableViewDelegate, NSTableViewDataSource
|
||||
self.tableView.registerForDraggedTypes([dragDropType])
|
||||
self.tableView.gridColor = .gridColor
|
||||
self.tableView.gridStyleMask = [.solidVerticalGridLineMask, .solidHorizontalGridLineMask]
|
||||
if #available(macOS 11.0, *) {
|
||||
self.tableView.style = .plain
|
||||
}
|
||||
self.tableView.style = .plain
|
||||
|
||||
self.tableView.addTableColumn(NSTableColumn(identifier: NSUserInterfaceItemIdentifier(rawValue: "name")))
|
||||
|
||||
|
||||
@@ -37,13 +37,7 @@ public struct Widget_c_s {
|
||||
}
|
||||
}
|
||||
public var margin: CGPoint {
|
||||
get {
|
||||
var point: CGPoint = CGPoint(x: 2, y: 2)
|
||||
if #available(macOS 11.0, *) {
|
||||
point.x = 0
|
||||
}
|
||||
return point
|
||||
}
|
||||
get { CGPoint(x: 0, y: 2) }
|
||||
}
|
||||
public let spacing: CGFloat = 2
|
||||
}
|
||||
|
||||
@@ -597,18 +597,8 @@ extension CGFloat {
|
||||
public class KeyboardShartcutView: NSStackView {
|
||||
private let callback: (_ value: [UInt16]) -> Void
|
||||
|
||||
private var startIcon: NSImage {
|
||||
if #available(macOS 12.0, *), let icon = iconFromSymbol(name: "record.circle", scale: .large) {
|
||||
return icon
|
||||
}
|
||||
return NSImage(named: NSImage.Name("record"))!
|
||||
}
|
||||
private var stopIcon: NSImage {
|
||||
if #available(macOS 12.0, *), let icon = iconFromSymbol(name: "stop.circle.fill", scale: .large) {
|
||||
return icon
|
||||
}
|
||||
return NSImage(named: NSImage.Name("stop"))!
|
||||
}
|
||||
private var startIcon: NSImage { iconFromSymbol(name: "record.circle", scale: .large) }
|
||||
private var stopIcon: NSImage { iconFromSymbol(name: "stop.circle.fill", scale: .large) }
|
||||
|
||||
private var valueField: NSTextField? = nil
|
||||
private var startButton: NSButton? = nil
|
||||
|
||||
@@ -1211,13 +1211,12 @@ public func controlState(_ sender: NSControl) -> Bool {
|
||||
return state == .on
|
||||
}
|
||||
|
||||
@available(macOS 11.0, *)
|
||||
public func iconFromSymbol(name: String, scale: NSImage.SymbolScale) -> NSImage? {
|
||||
public func iconFromSymbol(name: String, scale: NSImage.SymbolScale) -> NSImage {
|
||||
let config = NSImage.SymbolConfiguration(textStyle: .body, scale: scale)
|
||||
if let symbol = NSImage(systemSymbolName: name, accessibilityDescription: nil) {
|
||||
return symbol.withSymbolConfiguration(config)
|
||||
if let symbol = NSImage(systemSymbolName: name, accessibilityDescription: nil), let icon = symbol.withSymbolConfiguration(config) {
|
||||
return icon
|
||||
}
|
||||
return nil
|
||||
return NSImage()
|
||||
}
|
||||
|
||||
public func showAlert(_ message: String, _ information: String? = nil, _ style: NSAlert.Style = .informational) {
|
||||
|
||||
@@ -28,10 +28,10 @@ public struct module_c {
|
||||
if let state = dict["State"] as? Bool {
|
||||
self.defaultState = state
|
||||
}
|
||||
if let symbol = dict["Symbol"] as? String, #available(macOS 11.0, *) {
|
||||
if let symbol = dict["Symbol"] as? String {
|
||||
self.icon = NSImage(systemSymbolName: symbol, accessibilityDescription: nil)
|
||||
}
|
||||
if self.icon == nil, #available(macOS 11.0, *), let symbol = dict["AlternativeSymbol"] as? String {
|
||||
if self.icon == nil, let symbol = dict["AlternativeSymbol"] as? String {
|
||||
self.icon = NSImage(systemSymbolName: symbol, accessibilityDescription: nil)
|
||||
}
|
||||
|
||||
|
||||
@@ -678,18 +678,8 @@ private class ButtonSelectorView: NSStackView {
|
||||
return view
|
||||
}()
|
||||
|
||||
private var settingsIcon: NSImage {
|
||||
if #available(macOS 12.0, *), let icon = iconFromSymbol(name: "gear", scale: .large) {
|
||||
return icon
|
||||
}
|
||||
return NSImage(named: NSImage.Name("settings"))!
|
||||
}
|
||||
private var previewIcon: NSImage {
|
||||
if #available(macOS 12.0, *), let icon = iconFromSymbol(name: "command", scale: .large) {
|
||||
return icon
|
||||
}
|
||||
return NSImage(named: NSImage.Name("chart"))!
|
||||
}
|
||||
private var settingsIcon: NSImage { iconFromSymbol(name: "gear", scale: .large) }
|
||||
private var previewIcon: NSImage { iconFromSymbol(name: "command", scale: .large) }
|
||||
|
||||
private var button: NSButton? = nil
|
||||
private var isSettingsEnabled: Bool = false
|
||||
|
||||
@@ -32,11 +32,11 @@ public struct ColorValue: Equatable {
|
||||
self.color = color
|
||||
}
|
||||
|
||||
// swiftlint:disable operator_whitespace
|
||||
// swiftlint:disable function_name_whitespace
|
||||
public static func ==(lhs: ColorValue, rhs: ColorValue) -> Bool {
|
||||
return lhs.value == rhs.value
|
||||
}
|
||||
// swiftlint:enable operator_whitespace
|
||||
// swiftlint:enable function_name_whitespace
|
||||
}
|
||||
|
||||
public enum AppUpdateInterval: String {
|
||||
|
||||
Reference in New Issue
Block a user