This commit is contained in:
Serhiy Mytrovtsiy
2025-01-26 14:32:51 +01:00
parent 479b812f84
commit 9325e2001c
23 changed files with 41 additions and 48 deletions

View File

@@ -14,7 +14,7 @@ concurrency:
jobs:
build:
runs-on: macos-latest
runs-on: macos-15
steps:
- uses: actions/checkout@v4

View File

@@ -69,7 +69,7 @@ public enum ModuleType: Int {
case combined
public var rawValue: String {
public var stringValue: String {
switch self {
case .CPU: return "CPU"
case .RAM: return "RAM"

View File

@@ -18,7 +18,7 @@ open class NotificationsWrapper: NSStackView {
private var ids: [String: Bool?] = [:]
public init(_ module: ModuleType, _ ids: [String] = []) {
self.module = module.rawValue
self.module = module.stringValue
super.init(frame: NSRect.zero)
self.initIDs(ids)

View File

@@ -28,8 +28,8 @@ open class PopupWrapper: NSStackView, Popup_p {
open var sizeCallback: ((NSSize) -> Void)? = nil
public init(_ typ: ModuleType, frame: NSRect) {
self.title = typ.rawValue
self.keyboardShortcut = Store.shared.array(key: "\(typ.rawValue)_popup_keyboardShortcut", defaultValue: []) as? [UInt16] ?? []
self.title = typ.stringValue
self.keyboardShortcut = Store.shared.array(key: "\(typ.stringValue)_popup_keyboardShortcut", defaultValue: []) as? [UInt16] ?? []
super.init(frame: frame)
}

View File

@@ -20,8 +20,8 @@ open class PortalWrapper: NSStackView, Portal_p {
private let header: PortalHeader
public init(_ type: ModuleType, height: CGFloat = Constants.Popup.portalHeight) {
self.name = type.rawValue
self.header = PortalHeader(type.rawValue)
self.name = type.stringValue
self.header = PortalHeader(type.stringValue)
super.init(frame: NSRect(x: 0, y: 0, width: Constants.Popup.width, height: height))

View File

@@ -75,8 +75,8 @@ open class Reader<T: Codable>: NSObject, ReaderInternal_p {
self.callbackHandler = callback
super.init()
DB.shared.setup(T.self, "\(module.rawValue)@\(self.name)")
if let lastValue = DB.shared.findOne(T.self, key: "\(module.rawValue)@\(self.name)") {
DB.shared.setup(T.self, "\(module.stringValue)@\(self.name)")
if let lastValue = DB.shared.findOne(T.self, key: "\(module.stringValue)@\(self.name)") {
self.value = lastValue
callback(lastValue)
}
@@ -86,7 +86,7 @@ open class Reader<T: Codable>: NSObject, ReaderInternal_p {
}
deinit {
DB.shared.insert(key: "\(self.module.rawValue)@\(self.name)", value: self.value, ts: self.history)
DB.shared.insert(key: "\(self.module.stringValue)@\(self.name)", value: self.value, ts: self.history)
}
public func initStoreValues(title: String) {
@@ -102,10 +102,10 @@ open class Reader<T: Codable>: NSObject, ReaderInternal_p {
if let value {
self.callbackHandler(value)
if let ts = self.lastDBWrite, let interval = self.interval, Date().timeIntervalSince(ts) > interval * 10 {
DB.shared.insert(key: "\(self.module.rawValue)@\(self.name)", value: value, ts: self.history)
DB.shared.insert(key: "\(self.module.stringValue)@\(self.name)", value: value, ts: self.history)
self.lastDBWrite = Date()
} else if self.lastDBWrite == nil {
DB.shared.insert(key: "\(self.module.rawValue)@\(self.name)", value: value, ts: self.history)
DB.shared.insert(key: "\(self.module.stringValue)@\(self.name)", value: value, ts: self.history)
self.lastDBWrite = Date()
}
}
@@ -162,7 +162,7 @@ open class Reader<T: Codable>: NSObject, ReaderInternal_p {
}
public func save(_ value: T) {
DB.shared.insert(key: "\(self.module.rawValue)@\(self.name)", value: value, ts: self.history, force: true)
DB.shared.insert(key: "\(self.module.stringValue)@\(self.name)", value: value, ts: self.history, force: true)
}
}

View File

@@ -26,7 +26,7 @@ internal class Portal: NSStackView, Portal_p {
}
public init(_ module: ModuleType) {
self.name = module.rawValue
self.name = module.stringValue
super.init(frame: NSRect.zero)

View File

@@ -24,7 +24,7 @@ internal class Settings: NSStackView, Settings_v {
private var timeFormat: String = "short"
public init(_ module: ModuleType) {
self.title = module.rawValue
self.title = module.stringValue
self.numberOfProcesses = Store.shared.int(key: "\(self.title)_processes", defaultValue: self.numberOfProcesses)
self.timeFormat = Store.shared.string(key: "\(self.title)_timeFormat", defaultValue: self.timeFormat)

View File

@@ -35,7 +35,7 @@ internal class Settings: NSStackView, Settings_v {
private var groupByClustersView: NSSwitch? = nil
public init(_ module: ModuleType) {
self.title = module.rawValue
self.title = module.stringValue
self.hyperthreadState = Store.shared.bool(key: "\(self.title)_hyperhreading", defaultValue: self.hyperthreadState)
self.usagePerCoreState = Store.shared.bool(key: "\(self.title)_usagePerCore", defaultValue: self.usagePerCoreState)
self.splitValueState = Store.shared.bool(key: "\(self.title)_splitValue", defaultValue: self.splitValueState)
@@ -63,13 +63,6 @@ internal class Settings: NSStackView, Settings_v {
public func load(widgets: [widget_t]) {
self.subviews.forEach{ $0.removeFromSuperview() }
var hasIPG = false
#if arch(x86_64)
let path: CFString = "/Library/Frameworks/IntelPowerGadget.framework" as CFString
let bundleURL = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, path, CFURLPathStyle.cfurlposixPathStyle, true)
hasIPG = CFBundleCreate(kCFAllocatorDefault, bundleURL) != nil
#endif
self.addArrangedSubview(PreferencesSection([
PreferencesRow(localizedString("Update interval"), component: selectView(
action: #selector(self.changeUpdateInterval),

View File

@@ -21,7 +21,7 @@ public class Portal: NSStackView, Portal_p {
private var multiplyContainer: ScrollableStackView = ScrollableStackView(orientation: .horizontal)
init(_ module: ModuleType, list: [Clock_t]) {
self.name = module.rawValue
self.name = module.stringValue
super.init(frame: NSRect.zero)

View File

@@ -51,7 +51,7 @@ internal class Settings: NSStackView, Settings_v, NSTableViewDelegate, NSTableVi
private var deleteButton: NSButton? = nil
public init(_ module: ModuleType) {
self.title = module.rawValue
self.title = module.stringValue
super.init(frame: NSRect.zero)

View File

@@ -32,7 +32,7 @@ internal class Settings: NSStackView, Settings_v {
private var list: [String] = []
public init(_ module: ModuleType) {
self.title = module.rawValue
self.title = module.stringValue
self.selectedDisk = Store.shared.string(key: "\(self.title)_disk", defaultValue: "")
self.removableState = Store.shared.bool(key: "\(self.title)_removable", defaultValue: self.removableState)

View File

@@ -27,7 +27,7 @@ internal class Settings: NSStackView, Settings_v {
private var button: NSPopUpButton?
public init(_ module: ModuleType) {
self.title = module.rawValue
self.title = module.stringValue
self.selectedGPU = Store.shared.string(key: "\(self.title)_gpu", defaultValue: "")
self.updateIntervalValue = Store.shared.int(key: "\(self.title)_updateInterval", defaultValue: self.updateIntervalValue)
self.showTypeValue = Store.shared.bool(key: "\(self.title)_showType", defaultValue: self.showTypeValue)

View File

@@ -86,7 +86,7 @@ internal class Settings: NSStackView, Settings_v, NSTextFieldDelegate {
}
public init(_ module: ModuleType) {
self.title = module.rawValue
self.title = module.stringValue
self.numberOfProcesses = Store.shared.int(key: "\(self.title)_processes", defaultValue: self.numberOfProcesses)
self.readerType = Store.shared.string(key: "\(self.title)_reader", defaultValue: self.readerType)
self.usageReset = Store.shared.string(key: "\(self.title)_usageReset", defaultValue: self.usageReset)

View File

@@ -60,7 +60,7 @@ internal class Settings: NSStackView, Settings_v, NSTextFieldDelegate {
private let textWidgetHelpPanel: HelpHUD = HelpHUD(textWidgetHelp)
public init(_ module: ModuleType) {
self.title = module.rawValue
self.title = module.stringValue
self.updateIntervalValue = Store.shared.int(key: "\(self.title)_updateInterval", defaultValue: self.updateIntervalValue)
self.updateTopIntervalValue = Store.shared.int(key: "\(self.title)_updateTopInterval", defaultValue: self.updateTopIntervalValue)
self.numberOfProcesses = Store.shared.int(key: "\(self.title)_processes", defaultValue: self.numberOfProcesses)

View File

@@ -25,7 +25,7 @@ public class Portal: NSStackView, Portal_p {
}
init(_ name: ModuleType) {
self.name = name.rawValue
self.name = name.stringValue
super.init(frame: NSRect( x: 0, y: 0, width: Constants.Popup.width, height: Constants.Popup.portalHeight))

View File

@@ -33,7 +33,7 @@ internal class Settings: NSStackView, Settings_v {
private var selectedSensor: String = "Average System Total"
public init(_ module: ModuleType) {
self.title = module.rawValue
self.title = module.stringValue
self.hidState = SystemKit.shared.device.platform == .m1 ? true : false
super.init(frame: NSRect.zero)

View File

@@ -2861,7 +2861,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.15;
MARKETING_VERSION = 2.11.26;
MARKETING_VERSION = 2.11.27;
OTHER_LDFLAGS = "";
PRODUCT_BUNDLE_IDENTIFIER = eu.exelban.Stats;
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -2898,7 +2898,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.15;
MARKETING_VERSION = 2.11.26;
MARKETING_VERSION = 2.11.27;
OTHER_LDFLAGS = "";
PRODUCT_BUNDLE_IDENTIFIER = eu.exelban.Stats;
PRODUCT_NAME = "$(TARGET_NAME)";

View File

@@ -17,7 +17,7 @@
<key>CFBundleShortVersionString</key>
<string>$(MARKETING_VERSION)</string>
<key>CFBundleVersion</key>
<string>662</string>
<string>668</string>
<key>Description</key>
<string>Simple macOS system monitor in your menu bar</string>
<key>LSApplicationCategoryType</key>

View File

@@ -75,7 +75,7 @@
"Name" = "Nazwa";
"Format" = "Format";
"Turn off" = "Wyłączyć";
"Normal" = "Normal";
"Normal" = "Normalny";
"Warning" = "Ostrzeżenie";
"Critical" = "Krytyczny";
"Usage" = "Wykorzystanie";
@@ -195,7 +195,7 @@
"Static width" = "Statyczna szerokość";
"Tachometer widget" = "Tachometr";
"State widget" = "Stan";
"Text widget" = "Text widget";
"Text widget" = "Tekst";
"Show symbols" = "Pokaż symbole";
"Label widget" = "Etykieta";
"Number of reads in the chart" = "Liczba odczytów na wykresie";
@@ -328,7 +328,7 @@
"Write speed" = "Zapis";
"Read speed" = "Odczyt";
"Drives" = "Dyski";
"SMART data" = "SMART data";
"SMART data" = "SMART dane";
// Sensors
"Temperature unit" = "Jednostka temperatury";
@@ -394,7 +394,7 @@
"Latency" = "Opóźnienie";
"Upload speed" = "Wysyłka";
"Download speed" = "Pobranie";
"Address" = "Address";
"Address" = "Adres";
// Battery
"Level" = "Poziom naładowania";

View File

@@ -75,7 +75,7 @@
"Name" = "Название";
"Format" = "Формат";
"Turn off" = "Выключить";
"Normal" = "Normal";
"Normal" = "Нормальный";
"Warning" = "Предупреждение";
"Critical" = "Критический";
"Usage" = "Использование";
@@ -195,7 +195,7 @@
"Static width" = "Статическая ширина";
"Tachometer widget" = "Тахометр";
"State widget" = "Состояние";
"Text widget" = "Text widget";
"Text widget" = "Текст";
"Show symbols" = "Показать символы";
"Label widget" = "Этикетка";
"Number of reads in the chart" = "Количество чтений на графике";
@@ -328,7 +328,7 @@
"Write speed" = "Запись";
"Read speed" = "Чтение";
"Drives" = "Диски";
"SMART data" = "SMART data";
"SMART data" = "SMART данные";
// Sensors
"Temperature unit" = "Единица измерения температуры";
@@ -394,7 +394,7 @@
"Latency" = "Задержка";
"Upload speed" = "Выгрузка";
"Download speed" = "Загрузка";
"Address" = "Address";
"Address" = "Адрес";
// Battery
"Level" = "Уровень заряда";

View File

@@ -75,7 +75,7 @@
"Name" = "Назва";
"Format" = "Формат";
"Turn off" = "Вимкнути";
"Normal" = "Normal";
"Normal" = "Нормальний";
"Warning" = "Попереджнння";
"Critical" = "Критичний";
"Usage" = "Використання";
@@ -195,7 +195,7 @@
"Static width" = "Статична ширина";
"Tachometer widget" = "Тахометр";
"State widget" = "Стан";
"Text widget" = "Text widget";
"Text widget" = "Текст";
"Show symbols" = "Показати символи";
"Label widget" = "Етикетка";
"Number of reads in the chart" = "Кількість зчитувань на діаграмі";
@@ -328,7 +328,7 @@
"Write speed" = "Запис";
"Read speed" = "Зчитування";
"Drives" = "Диски";
"SMART data" = "SMART data";
"SMART data" = "SMART дані";
// Sensors
"Temperature unit" = "Одиниця виміру температури";
@@ -394,7 +394,7 @@
"Latency" = "Затримка";
"Upload speed" = "Висилання";
"Download speed" = "Завантаження";
"Address" = "Address";
"Address" = "Адреса";
// Battery
"Level" = "Рівень заряду";

View File

@@ -11,9 +11,9 @@
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleShortVersionString</key>
<string>2.11.26</string>
<string>2.11.27</string>
<key>CFBundleVersion</key>
<string>662</string>
<string>668</string>
<key>NSExtension</key>
<dict>
<key>NSExtensionPointIdentifier</key>