Conversion to swift 4
This commit is contained in:
@@ -24,7 +24,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
|
||||
// URL Session for DOCSIS data and Internet check
|
||||
let urlSession: URLSession = URLSession(configuration: .default)
|
||||
// Preferences
|
||||
let pref: NSWindowController = NSWindowController(windowNibName: "SettingsWindowController")
|
||||
let pref: NSWindowController = NSWindowController(windowNibName: NSNib.Name(rawValue: "SettingsWindowController"))
|
||||
// Timers
|
||||
var timerFreqs: Timer = Timer()
|
||||
var timerFails: Timer = Timer()
|
||||
@@ -52,7 +52,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
|
||||
justTime.locale = Locale(identifier: "de_DE")
|
||||
|
||||
// Set status item
|
||||
statusItem = NSStatusBar.system().statusItem(withLength: -2)
|
||||
statusItem = NSStatusBar.system.statusItem(withLength: -2)
|
||||
statusItem.title = "AL"
|
||||
// Create status item menu
|
||||
let menu: NSMenu = NSMenu.init()
|
||||
@@ -60,7 +60,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
|
||||
let menuAbout: NSMenuItem = NSMenuItem(title: "About Logger", action: #selector(NSApp.orderFrontStandardAboutPanel(_:)), keyEquivalent: "")
|
||||
let menuQuit: NSMenuItem = NSMenuItem.init(title: "Quit", action: #selector(NSApp.terminate(_:)), keyEquivalent: "q")
|
||||
let menuPref: NSMenuItem = NSMenuItem(title: "Preferences", action: #selector(self.preferences(_:)), keyEquivalent: "")
|
||||
menuPref.image = NSImage(named: NSImageNameActionTemplate)
|
||||
menuPref.image = NSImage(named: NSImage.Name.actionTemplate)
|
||||
// Layout menu
|
||||
menu.addItem(menuAbout)
|
||||
menu.addItem(NSMenuItem.separator())
|
||||
@@ -97,26 +97,26 @@ class AppDelegate: NSObject, NSApplicationDelegate {
|
||||
}
|
||||
}
|
||||
|
||||
func applicationShouldTerminate(_ sender: NSApplication) -> NSApplicationTerminateReply {
|
||||
func applicationShouldTerminate(_ sender: NSApplication) -> NSApplication.TerminateReply {
|
||||
urlSession.invalidateAndCancel()
|
||||
return .terminateNow
|
||||
}
|
||||
|
||||
// MARK: - Logging Functions
|
||||
|
||||
func logFreqs(_: Timer) {
|
||||
@objc func logFreqs(_: Timer) {
|
||||
let frequencyOperation: FrequencyOperation = FrequencyOperation()
|
||||
OperationQueue.main.addOperation(frequencyOperation)
|
||||
}
|
||||
|
||||
func logFails(_: Timer) {
|
||||
@objc func logFails(_: Timer) {
|
||||
let connectionLossOperation: ConnectionLossOperation = ConnectionLossOperation()
|
||||
OperationQueue.main.addOperation(connectionLossOperation)
|
||||
}
|
||||
|
||||
// MARK: - General functions
|
||||
|
||||
func preferences(_ sender: NSMenuItem) {
|
||||
@objc func preferences(_ sender: NSMenuItem) {
|
||||
timerFreqs.invalidate()
|
||||
timerFails.invalidate()
|
||||
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>4.2</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>49</string>
|
||||
<string>50</string>
|
||||
<key>LSApplicationCategoryType</key>
|
||||
<string>public.app-category.utilities</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
version 4.2
|
||||
build 49
|
||||
build 50
|
||||
|
||||
Reference in New Issue
Block a user