Compatibility with prior versions: displaying scheduler linit by default.

This commit is contained in:
macmade
2023-02-06 20:22:30 +01:00
parent 551f91f6bd
commit 40868ccec8

View File

@@ -52,34 +52,7 @@ class ApplicationDelegate: NSObject, NSApplicationDelegate, NSWindowDelegate
func applicationDidFinishLaunching( _ notification: Notification )
{
if UserDefaults.standard.object( forKey: "LastLaunch" ) == nil
{
UserDefaults.standard.setValue( true, forKey: "automaticallyCheckForUpdates" )
UserDefaults.standard.setValue( true, forKey: "displayCPUTemperature" )
UserDefaults.standard.setValue( true, forKey: "displaySchedulerLimit" )
UserDefaults.standard.setValue( true, forKey: "colorizeStatusItemText" )
UserDefaults.standard.setValue( NSDate(), forKey: "LastLaunch" )
}
if UserDefaults.standard.object( forKey: "refreshInterval" ) == nil
{
UserDefaults.standard.setValue( 2, forKey: "refreshInterval" )
}
if UserDefaults.standard.object( forKey: "sensorsWindowShowTemperature" ) == nil
{
UserDefaults.standard.setValue( true, forKey: "sensorsWindowShowTemperature" )
}
if UserDefaults.standard.object( forKey: "sensorsWindowShowVoltage" ) == nil
{
UserDefaults.standard.setValue( true, forKey: "sensorsWindowShowVoltage" )
}
if UserDefaults.standard.object( forKey: "sensorsWindowShowCurrent" ) == nil
{
UserDefaults.standard.setValue( true, forKey: "sensorsWindowShowCurrent" )
}
self.initializePreferences()
self.aboutWindowController = AboutWindowController()
self.preferencesWindowController = PreferencesWindowController()
@@ -128,6 +101,44 @@ class ApplicationDelegate: NSObject, NSApplicationDelegate, NSWindowDelegate
}
}
private func initializePreferences()
{
if UserDefaults.standard.object( forKey: "LastLaunch" ) == nil
{
UserDefaults.standard.setValue( true, forKey: "automaticallyCheckForUpdates" )
UserDefaults.standard.setValue( true, forKey: "displayCPUTemperature" )
UserDefaults.standard.setValue( true, forKey: "displaySchedulerLimit" )
UserDefaults.standard.setValue( true, forKey: "colorizeStatusItemText" )
UserDefaults.standard.setValue( NSDate(), forKey: "LastLaunch" )
}
if UserDefaults.standard.object( forKey: "refreshInterval" ) == nil
{
UserDefaults.standard.setValue( 2, forKey: "refreshInterval" )
}
if UserDefaults.standard.object( forKey: "sensorsWindowShowTemperature" ) == nil
{
UserDefaults.standard.setValue( true, forKey: "sensorsWindowShowTemperature" )
}
if UserDefaults.standard.object( forKey: "sensorsWindowShowVoltage" ) == nil
{
UserDefaults.standard.setValue( true, forKey: "sensorsWindowShowVoltage" )
}
if UserDefaults.standard.object( forKey: "sensorsWindowShowCurrent" ) == nil
{
UserDefaults.standard.setValue( true, forKey: "sensorsWindowShowCurrent" )
}
if UserDefaults.standard.object( forKey: "displaySchedulerLimit" ) == nil
{
// Added in 1.8.0
UserDefaults.standard.setValue( true, forKey: "displaySchedulerLimit" )
}
}
private func updateMenuFont()
{
let system = NSFont.monospacedDigitSystemFont( ofSize: NSFont.smallSystemFontSize, weight: .light )