mirror of
https://github.com/morgan9e/macos-stats
synced 2026-04-14 00:04:15 +09:00
feat: renamed OneView to the "Combined modules" (#1084)
This commit is contained in:
@@ -343,8 +343,8 @@ public class MenuBar {
|
||||
private var menuBarItem: NSStatusItem? = nil
|
||||
private var active: Bool = false
|
||||
|
||||
private var globalOneView: Bool {
|
||||
Store.shared.bool(key: "OneView", defaultValue: false)
|
||||
private var combinedModules: Bool {
|
||||
Store.shared.bool(key: "CombinedModules", defaultValue: false)
|
||||
}
|
||||
|
||||
public var view: MenuBarView = MenuBarView()
|
||||
@@ -367,7 +367,7 @@ public class MenuBar {
|
||||
self.oneView = Store.shared.bool(key: "\(self.moduleName)_oneView", defaultValue: self.oneView)
|
||||
self.view.identifier = NSUserInterfaceItemIdentifier(rawValue: moduleName)
|
||||
|
||||
if self.globalOneView {
|
||||
if self.combinedModules {
|
||||
self.oneView = true
|
||||
} else {
|
||||
self.setupMenuBarItem(self.oneView)
|
||||
@@ -413,7 +413,7 @@ public class MenuBar {
|
||||
}
|
||||
|
||||
public func enable() {
|
||||
if self.oneView && !self.globalOneView {
|
||||
if self.oneView && !self.combinedModules {
|
||||
self.setupMenuBarItem(true)
|
||||
}
|
||||
self.active = true
|
||||
@@ -489,7 +489,7 @@ public class MenuBar {
|
||||
w.disable()
|
||||
}
|
||||
|
||||
if self.globalOneView {
|
||||
if self.combinedModules {
|
||||
self.oneView = true
|
||||
self.setupMenuBarItem(false)
|
||||
} else {
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
5C0A2A8A292A5B4D009B4C1F /* SMJobBlessUtil.py in Resources */ = {isa = PBXBuildFile; fileRef = 5C0A2A89292A5B4D009B4C1F /* SMJobBlessUtil.py */; };
|
||||
5C21D80B296C7B81005BA16D /* OneView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5C21D80A296C7B81005BA16D /* OneView.swift */; };
|
||||
5C21D80B296C7B81005BA16D /* CombinedView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5C21D80A296C7B81005BA16D /* CombinedView.swift */; };
|
||||
5C8E001029269C7F0027C75A /* protocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5CFE493829265055000F2856 /* protocol.swift */; };
|
||||
5CFE492A29264DF1000F2856 /* main.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5CFE492929264DF1000F2856 /* main.swift */; };
|
||||
5CFE493929265055000F2856 /* protocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5CFE493829265055000F2856 /* protocol.swift */; };
|
||||
@@ -346,7 +346,7 @@
|
||||
40BE2B202745D63800AE9396 /* da */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = da; path = da.lproj/Localizable.strings; sourceTree = "<group>"; };
|
||||
4921436D25319699000A1C47 /* ko */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ko; path = ko.lproj/Localizable.strings; sourceTree = "<group>"; };
|
||||
5C0A2A89292A5B4D009B4C1F /* SMJobBlessUtil.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = SMJobBlessUtil.py; sourceTree = "<group>"; };
|
||||
5C21D80A296C7B81005BA16D /* OneView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OneView.swift; sourceTree = "<group>"; };
|
||||
5C21D80A296C7B81005BA16D /* CombinedView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CombinedView.swift; sourceTree = "<group>"; };
|
||||
5CFE492729264DF1000F2856 /* eu.exelban.Stats.SMC.Helper */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = eu.exelban.Stats.SMC.Helper; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
5CFE492929264DF1000F2856 /* main.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = main.swift; sourceTree = "<group>"; };
|
||||
5CFE493829265055000F2856 /* protocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = protocol.swift; sourceTree = "<group>"; };
|
||||
@@ -799,7 +799,7 @@
|
||||
9A81C74B24499C7000825D92 /* AppSettings.swift */,
|
||||
9A9EA9442476D34500E3B883 /* Update.swift */,
|
||||
9A83526E2889A03100791BAC /* Setup.swift */,
|
||||
5C21D80A296C7B81005BA16D /* OneView.swift */,
|
||||
5C21D80A296C7B81005BA16D /* CombinedView.swift */,
|
||||
);
|
||||
path = Views;
|
||||
sourceTree = "<group>";
|
||||
@@ -1582,7 +1582,7 @@
|
||||
9A045EB72594F8D100ED58F2 /* Dashboard.swift in Sources */,
|
||||
9A81C74E24499C7000825D92 /* Settings.swift in Sources */,
|
||||
9A81C74D24499C7000825D92 /* AppSettings.swift in Sources */,
|
||||
5C21D80B296C7B81005BA16D /* OneView.swift in Sources */,
|
||||
5C21D80B296C7B81005BA16D /* CombinedView.swift in Sources */,
|
||||
9A83526F2889A03100791BAC /* Setup.swift in Sources */,
|
||||
9AD33AC624BCD3EE007E8820 /* helpers.swift in Sources */,
|
||||
);
|
||||
|
||||
@@ -40,7 +40,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCenterDele
|
||||
internal let updateActivity = NSBackgroundActivityScheduler(identifier: "eu.exelban.Stats.updateCheck")
|
||||
internal var clickInNotification: Bool = false
|
||||
internal var menuBarItem: NSStatusItem? = nil
|
||||
internal var oneView: OneView = OneView()
|
||||
internal var combinedView: CombinedView = CombinedView()
|
||||
|
||||
internal var pauseState: Bool {
|
||||
Store.shared.bool(key: "pause", defaultValue: false)
|
||||
|
||||
@@ -121,6 +121,7 @@
|
||||
"Reset settings" = "Зануляване на настройките";
|
||||
"Pause the Stats" = "Паузиране на Stats";
|
||||
"Resume the Stats" = "Продължаване на Stats";
|
||||
"Combined modules" = "Combined modules";
|
||||
|
||||
// Dashboard
|
||||
"Serial number" = "Сериен номер";
|
||||
|
||||
@@ -121,6 +121,7 @@
|
||||
"Reset settings" = "Reset settings";
|
||||
"Pause the Stats" = "Pause the Stats";
|
||||
"Resume the Stats" = "Resume the Stats";
|
||||
"Combined modules" = "Combined modules";
|
||||
|
||||
// Dashboard
|
||||
"Serial number" = "Número de sèrie";
|
||||
|
||||
@@ -121,6 +121,7 @@
|
||||
"Reset settings" = "Obnovit nastavení";
|
||||
"Pause the Stats" = "Pozastavit Stats";
|
||||
"Resume the Stats" = "Obnovit Stats";
|
||||
"Combined modules" = "Combined modules";
|
||||
|
||||
// Dashboard
|
||||
"Serial number" = "Sériové číslo";
|
||||
|
||||
@@ -121,6 +121,7 @@
|
||||
"Reset settings" = "Reset settings";
|
||||
"Pause the Stats" = "Pause the Stats";
|
||||
"Resume the Stats" = "Resume the Stats";
|
||||
"Combined modules" = "Combined modules";
|
||||
|
||||
// Dashboard
|
||||
"Serial number" = "Serienummer";
|
||||
|
||||
@@ -121,6 +121,7 @@
|
||||
"Reset settings" = "Einstellungen zurücksetzen";
|
||||
"Pause the Stats" = "Stats pausieren";
|
||||
"Resume the Stats" = "Stats fortsetzen";
|
||||
"Combined modules" = "Combined modules";
|
||||
|
||||
// Dashboard
|
||||
"Serial number" = "Seriennummer";
|
||||
|
||||
@@ -121,6 +121,7 @@
|
||||
"Reset settings" = "Επαναφορά ρυθμίσεων";
|
||||
"Pause the Stats" = "Pause the Stats";
|
||||
"Resume the Stats" = "Resume the Stats";
|
||||
"Combined modules" = "Combined modules";
|
||||
|
||||
// Dashboard
|
||||
"Serial number" = "Σειριακός αριθμός";
|
||||
|
||||
@@ -121,6 +121,7 @@
|
||||
"Reset settings" = "Reset settings";
|
||||
"Pause the Stats" = "Pause the Stats";
|
||||
"Resume the Stats" = "Resume the Stats";
|
||||
"Combined modules" = "Combined modules";
|
||||
|
||||
// Dashboard
|
||||
"Serial number" = "Serial number";
|
||||
|
||||
@@ -121,6 +121,7 @@
|
||||
"Reset settings" = "Reset settings";
|
||||
"Pause the Stats" = "Pause the Stats";
|
||||
"Resume the Stats" = "Resume the Stats";
|
||||
"Combined modules" = "Combined modules";
|
||||
|
||||
// Dashboard
|
||||
"Serial number" = "Número de serie";
|
||||
|
||||
@@ -121,6 +121,7 @@
|
||||
"Reset settings" = "ریست تنظیمات";
|
||||
"Pause the Stats" = "متوقف کردن Stats";
|
||||
"Resume the Stats" = "ادامهی کار Stats";
|
||||
"Combined modules" = "Combined modules";
|
||||
|
||||
// Dashboard
|
||||
"Serial number" = "سریال نامبر";
|
||||
|
||||
@@ -121,6 +121,7 @@
|
||||
"Reset settings" = "Reset settings";
|
||||
"Pause the Stats" = "Pause the Stats";
|
||||
"Resume the Stats" = "Resume the Stats";
|
||||
"Combined modules" = "Combined modules";
|
||||
|
||||
// Dashboard
|
||||
"Serial number" = "Numéro de série";
|
||||
|
||||
@@ -121,6 +121,7 @@
|
||||
"Reset settings" = "איפוס הגדרות";
|
||||
"Pause the Stats" = "Pause the Stats";
|
||||
"Resume the Stats" = "Resume the Stats";
|
||||
"Combined modules" = "Combined modules";
|
||||
|
||||
// Dashboard
|
||||
"Serial number" = "מספר סריאלי";
|
||||
|
||||
@@ -121,6 +121,7 @@
|
||||
"Reset settings" = "Resetiraj postavke";
|
||||
"Pause the Stats" = "Pause the Stats";
|
||||
"Resume the Stats" = "Resume the Stats";
|
||||
"Combined modules" = "Combined modules";
|
||||
|
||||
// Dashboard
|
||||
"Serial number" = "Serijski broj";
|
||||
|
||||
@@ -121,6 +121,7 @@
|
||||
"Reset settings" = "Beállítások alaphelyzetbe állítása";
|
||||
"Pause the Stats" = "Stats felfüggesztése";
|
||||
"Resume the Stats" = "Stats folytatása";
|
||||
"Combined modules" = "Combined modules";
|
||||
|
||||
// Dashboard
|
||||
"Serial number" = "Sorozatszám";
|
||||
|
||||
@@ -121,6 +121,7 @@
|
||||
"Reset settings" = "Atur ulang pengaturan";
|
||||
"Pause the Stats" = "Pause the Stats";
|
||||
"Resume the Stats" = "Resume the Stats";
|
||||
"Combined modules" = "Combined modules";
|
||||
|
||||
// Dashboard
|
||||
"Serial number" = "Nomor serial";
|
||||
|
||||
@@ -121,6 +121,7 @@
|
||||
"Reset settings" = "Reset settings";
|
||||
"Pause the Stats" = "Pause the Stats";
|
||||
"Resume the Stats" = "Resume the Stats";
|
||||
"Combined modules" = "Combined modules";
|
||||
|
||||
// Dashboard
|
||||
"Serial number" = "Numero di serie";
|
||||
|
||||
@@ -121,6 +121,7 @@
|
||||
"Reset settings" = "設定をリセット";
|
||||
"Pause the Stats" = "Pause the Stats";
|
||||
"Resume the Stats" = "Resume the Stats";
|
||||
"Combined modules" = "Combined modules";
|
||||
|
||||
// Dashboard
|
||||
"Serial number" = "シリアル番号";
|
||||
|
||||
@@ -121,6 +121,7 @@
|
||||
"Reset settings" = "설정 초기화";
|
||||
"Pause the Stats" = "Pause the Stats";
|
||||
"Resume the Stats" = "Resume the Stats";
|
||||
"Combined modules" = "Combined modules";
|
||||
|
||||
// Dashboard
|
||||
"Serial number" = "일련 번호";
|
||||
|
||||
@@ -121,6 +121,7 @@
|
||||
"Reset settings" = "Nullstill innstillinger";
|
||||
"Pause the Stats" = "Sett Stats på pause";
|
||||
"Resume the Stats" = "Gjenoppta Stats";
|
||||
"Combined modules" = "Combined modules";
|
||||
|
||||
// Dashboard
|
||||
"Serial number" = "Serienummer";
|
||||
|
||||
@@ -121,6 +121,7 @@
|
||||
"Reset settings" = "Reset settings";
|
||||
"Pause the Stats" = "Pause the Stats";
|
||||
"Resume the Stats" = "Resume the Stats";
|
||||
"Combined modules" = "Combined modules";
|
||||
|
||||
// Dashboard
|
||||
"Serial number" = "Serienummer";
|
||||
|
||||
@@ -121,6 +121,7 @@
|
||||
"Reset settings" = "Resetowanie ustawień";
|
||||
"Pause the Stats" = "Wstrzymaj Stats";
|
||||
"Resume the Stats" = "Wznów Stats";
|
||||
"Combined modules" = "Połączone moduły";
|
||||
|
||||
// Dashboard
|
||||
"Serial number" = "Numer seryjny";
|
||||
|
||||
@@ -121,6 +121,7 @@
|
||||
"Reset settings" = "Reset settings";
|
||||
"Pause the Stats" = "Pause the Stats";
|
||||
"Resume the Stats" = "Resume the Stats";
|
||||
"Combined modules" = "Combined modules";
|
||||
|
||||
// Dashboard
|
||||
"Serial number" = "Número de série";
|
||||
|
||||
@@ -121,6 +121,7 @@
|
||||
"Reset settings" = "Reset settings";
|
||||
"Pause the Stats" = "Pause the Stats";
|
||||
"Resume the Stats" = "Resume the Stats";
|
||||
"Combined modules" = "Combined modules";
|
||||
|
||||
// Dashboard
|
||||
"Serial number" = "Número de série";
|
||||
|
||||
@@ -121,6 +121,7 @@
|
||||
"Reset settings" = "Reset settings";
|
||||
"Pause the Stats" = "Pause the Stats";
|
||||
"Resume the Stats" = "Resume the Stats";
|
||||
"Combined modules" = "Combined modules";
|
||||
|
||||
// Dashboard
|
||||
"Serial number" = "Număr de serie";
|
||||
|
||||
@@ -121,6 +121,7 @@
|
||||
"Reset settings" = "Сбросить настройки";
|
||||
"Pause the Stats" = "Приостановить Stats";
|
||||
"Resume the Stats" = "Возобновить Stats";
|
||||
"Combined modules" = "Комбинированные модули";
|
||||
|
||||
// Dashboard
|
||||
"Serial number" = "Серийный номер";
|
||||
|
||||
@@ -121,6 +121,7 @@
|
||||
"Reset settings" = "Ponastavi nastavitve";
|
||||
"Pause the Stats" = "Začasno zaustavi Stats";
|
||||
"Resume the Stats" = "Nadaljuj z izvajanjem Stats";
|
||||
"Combined modules" = "Combined modules";
|
||||
|
||||
// Dashboard
|
||||
"Serial number" = "Serijska številka";
|
||||
|
||||
@@ -121,6 +121,7 @@
|
||||
"Reset settings" = "Återställ inställningar";
|
||||
"Pause the Stats" = "Pause the Stats";
|
||||
"Resume the Stats" = "Resume the Stats";
|
||||
"Combined modules" = "Combined modules";
|
||||
|
||||
// Dashboard
|
||||
"Serial number" = "Serienummer";
|
||||
|
||||
@@ -121,6 +121,7 @@
|
||||
"Reset settings" = "Ayarları sıfırla";
|
||||
"Pause the Stats" = "Stats'ı Duraklat";
|
||||
"Resume the Stats" = "Stats'ı Sürdür";
|
||||
"Combined modules" = "Combined modules";
|
||||
|
||||
// Dashboard
|
||||
"Serial number" = "Seri numarası";
|
||||
|
||||
@@ -121,6 +121,7 @@
|
||||
"Reset settings" = "Скинути налаштування";
|
||||
"Pause the Stats" = "Призупинити Stats";
|
||||
"Resume the Stats" = "Відновити Stats";
|
||||
"Combined modules" = "Комбіновані модулі";
|
||||
|
||||
// Dashboard
|
||||
"Serial number" = "Серійний номер";
|
||||
|
||||
@@ -121,6 +121,7 @@
|
||||
"Reset settings" = "Thiết lập lại cài đặt";
|
||||
"Pause the Stats" = "Pause the Stats";
|
||||
"Resume the Stats" = "Resume the Stats";
|
||||
"Combined modules" = "Combined modules";
|
||||
|
||||
// Dashboard
|
||||
"Serial number" = "Số sê-ri";
|
||||
|
||||
@@ -121,6 +121,7 @@
|
||||
"Reset settings" = "初始化所有设置";
|
||||
"Pause the Stats" = "暂停 Stats";
|
||||
"Resume the Stats" = "恢复 Stats";
|
||||
"Combined modules" = "Combined modules";
|
||||
|
||||
// Dashboard
|
||||
"Serial number" = "序列号";
|
||||
|
||||
@@ -121,6 +121,7 @@
|
||||
"Reset settings" = "重置設定";
|
||||
"Pause the Stats" = "暫停 Stats";
|
||||
"Resume the Stats" = "恢復 Stats";
|
||||
"Combined modules" = "Combined modules";
|
||||
|
||||
// Dashboard
|
||||
"Serial number" = "序號";
|
||||
|
||||
@@ -26,12 +26,12 @@ class ApplicationSettings: NSStackView {
|
||||
}
|
||||
}
|
||||
|
||||
private var oneViewState: Bool {
|
||||
private var combinedModulesState: Bool {
|
||||
get {
|
||||
Store.shared.bool(key: "OneView", defaultValue: false)
|
||||
Store.shared.bool(key: "CombinedModules", defaultValue: false)
|
||||
}
|
||||
set {
|
||||
Store.shared.set(key: "OneView", value: newValue)
|
||||
Store.shared.set(key: "CombinedModules", value: newValue)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -186,15 +186,15 @@ class ApplicationSettings: NSStackView {
|
||||
)
|
||||
grid.addRow(with: [NSGridCell.emptyContentView, self.startAtLoginBtn!])
|
||||
grid.addRow(with: [NSGridCell.emptyContentView, self.toggleView(
|
||||
action: #selector(self.toggleOneView),
|
||||
state: self.oneViewState,
|
||||
text: localizedString("OneView")
|
||||
action: #selector(self.toggleCombinedModules),
|
||||
state: self.combinedModulesState,
|
||||
text: localizedString("Combined modules")
|
||||
)])
|
||||
|
||||
view.addArrangedSubview(self.moduleSelector)
|
||||
view.addArrangedSubview(grid)
|
||||
|
||||
self.moduleSelector.isHidden = !self.oneViewState
|
||||
self.moduleSelector.isHidden = !self.combinedModulesState
|
||||
|
||||
return view
|
||||
}
|
||||
@@ -238,42 +238,6 @@ class ApplicationSettings: NSStackView {
|
||||
return view
|
||||
}
|
||||
|
||||
private func oneViewSettingsView() -> NSView {
|
||||
let view: NSView = NSView(frame: NSRect(x: 0, y: 0, width: self.frame.width, height: 0))
|
||||
let grid: NSGridView = NSGridView(frame: NSRect(x: 0, y: 0, width: view.frame.width, height: 0))
|
||||
grid.rowSpacing = 10
|
||||
grid.columnSpacing = 20
|
||||
grid.xPlacement = .trailing
|
||||
grid.rowAlignment = .firstBaseline
|
||||
grid.translatesAutoresizingMaskIntoConstraints = false
|
||||
|
||||
grid.setContentHuggingPriority(.defaultHigh, for: .horizontal)
|
||||
grid.setContentHuggingPriority(.defaultHigh, for: .vertical)
|
||||
|
||||
grid.addRow(with: [self.moduleSelector])
|
||||
|
||||
view.addSubview(grid)
|
||||
|
||||
var height: CGFloat = grid.rowSpacing
|
||||
for i in 0..<grid.numberOfRows {
|
||||
let row = grid.row(at: i)
|
||||
for a in 0..<row.numberOfCells {
|
||||
if let contentView = row.cell(at: a).contentView {
|
||||
height += contentView.frame.height
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
view.setFrameSize(NSSize(width: view.frame.width, height: height))
|
||||
NSLayoutConstraint.activate([
|
||||
view.heightAnchor.constraint(equalToConstant: height),
|
||||
grid.centerXAnchor.constraint(equalTo: view.centerXAnchor),
|
||||
grid.centerYAnchor.constraint(equalTo: view.centerYAnchor)
|
||||
])
|
||||
|
||||
return view
|
||||
}
|
||||
|
||||
// MARK: - helpers
|
||||
|
||||
private func separatorView() -> NSBox {
|
||||
@@ -390,9 +354,9 @@ class ApplicationSettings: NSStackView {
|
||||
SMCHelper.shared.uninstall()
|
||||
}
|
||||
|
||||
@objc private func toggleOneView(_ sender: NSButton) {
|
||||
self.oneViewState = sender.state == NSControl.StateValue.on
|
||||
self.moduleSelector.isHidden = !self.oneViewState
|
||||
@objc private func toggleCombinedModules(_ sender: NSButton) {
|
||||
self.combinedModulesState = sender.state == NSControl.StateValue.on
|
||||
self.moduleSelector.isHidden = !self.combinedModulesState
|
||||
NotificationCenter.default.post(name: .toggleOneView, object: nil, userInfo: nil)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// OneView.swift
|
||||
// CombinedView.swift
|
||||
// Stats
|
||||
//
|
||||
// Created by Serhiy Mytrovtsiy on 09/01/2023
|
||||
@@ -12,12 +12,12 @@
|
||||
import Cocoa
|
||||
import Kit
|
||||
|
||||
class OneView {
|
||||
class CombinedView {
|
||||
private var menuBarItem: NSStatusItem? = nil
|
||||
private var view: NSView = NSView(frame: NSRect(x: 0, y: 0, width: 100, height: Constants.Widget.height))
|
||||
|
||||
private var status: Bool {
|
||||
Store.shared.bool(key: "OneView", defaultValue: false)
|
||||
Store.shared.bool(key: "CombinedModules", defaultValue: false)
|
||||
}
|
||||
|
||||
init() {
|
||||
@@ -45,7 +45,7 @@ class OneView {
|
||||
|
||||
public func enable() {
|
||||
self.menuBarItem = NSStatusBar.system.statusItem(withLength: 0)
|
||||
self.menuBarItem?.autosaveName = "OneView"
|
||||
self.menuBarItem?.autosaveName = "CombinedModules"
|
||||
self.menuBarItem?.button?.addSubview(self.view)
|
||||
|
||||
self.menuBarItem?.button?.target = self
|
||||
Reference in New Issue
Block a user