diff --git a/EhautX/AppDelegate.swift b/EhautX/AppDelegate.swift index 3311af0..8768937 100644 --- a/EhautX/AppDelegate.swift +++ b/EhautX/AppDelegate.swift @@ -16,10 +16,24 @@ extension PreferencePane.Identifier { } extension DefaultsKeys { - static let server = DefaultsKey("server", defaultValue: "http://172.16.154.130:69/cgi-bin/srun_portal") + static let authServer = DefaultsKey("authServer", defaultValue: "http://172.16.154.130/cgi-bin/srun_portal") + static let msgServer = DefaultsKey("msgServer", defaultValue: "http://172.16.154.130/get_msg.php") + static let infoServer = DefaultsKey("infoServer", defaultValue: "http://172.16.154.130/cgi-bin/rad_user_info") static let username = DefaultsKey("username") static let password = DefaultsKey("password") static let passwordKey = DefaultsKey("passwordKey", defaultValue: "1234567890") + + static let acid = DefaultsKey("acid", defaultValue: "1") + static let type = DefaultsKey("type", defaultValue: "10") + static let n = DefaultsKey("n", defaultValue: "117") + static let drop = DefaultsKey("drop", defaultValue: "0") + static let pop = DefaultsKey("pop", defaultValue: "1") + static let mbytes = DefaultsKey("mbytes", defaultValue: "0") + static let minutes = DefaultsKey("minutes", defaultValue: "0") + + static let only_acid = DefaultsKey("only_acid", defaultValue: false) + + static let timeout = DefaultsKey("timeout", defaultValue: 3) } @NSApplicationMain @@ -47,7 +61,7 @@ class AppDelegate: NSObject, NSApplicationDelegate { let menu = NSMenu() menu.addItem(NSMenuItem( title: "About", - action: #selector(NSApplication.shared.orderFrontStandardAboutPanel(options:)), + action: #selector(NSApplication.shared.orderFrontStandardAboutPanel(_:)), keyEquivalent: "" )) menu.addItem(NSMenuItem.separator()) @@ -56,6 +70,12 @@ class AppDelegate: NSObject, NSApplicationDelegate { action: #selector(self.preferencesMenuItemActionHandler(_:)), keyEquivalent: "," )) + menu.addItem(NSMenuItem.separator()) + menu.addItem(NSMenuItem( + title: "Quit", + action: #selector(NSApplication.shared.terminate(_:)), + keyEquivalent: "q" + )) statusItem.menu = menu } diff --git a/EhautX/Views/AdvancedPrefsViewController.swift b/EhautX/Views/AdvancedPrefsViewController.swift index 6a4a249..5c0a4a7 100644 --- a/EhautX/Views/AdvancedPrefsViewController.swift +++ b/EhautX/Views/AdvancedPrefsViewController.swift @@ -15,9 +15,19 @@ class AdvancedPrefsViewController: NSViewController, PreferencePane { let preferencePaneTitle = "Advanced" let toolbarItemIcon = NSImage(named: NSImage.advancedName)! - @objc dynamic var server: String { - get { return Defaults[.server] } - set { Defaults[.server] = newValue } + @objc dynamic var authServer: String { + get { return Defaults[.authServer] } + set { Defaults[.authServer] = newValue } + } + + @objc dynamic var msgServer: String { + get { return Defaults[.msgServer] } + set { Defaults[.msgServer] = newValue } + } + + @objc dynamic var infoServer: String { + get { return Defaults[.infoServer] } + set { Defaults[.infoServer] = newValue } } @objc dynamic var passwordKey: String { @@ -25,6 +35,46 @@ class AdvancedPrefsViewController: NSViewController, PreferencePane { set { Defaults[.passwordKey] = newValue } } + @objc dynamic var acid: String { + get { return Defaults[.acid] } + set { Defaults[.acid] = newValue } + } + + @objc dynamic var only_acid: Bool { + get { return Defaults[.only_acid] } + set { Defaults[.only_acid] = newValue } + } + + @objc dynamic var type: String { + get { return Defaults[.type] } + set { Defaults[.type] = newValue } + } + + @objc dynamic var n: String { + get { return Defaults[.n] } + set { Defaults[.n] = newValue } + } + + @objc dynamic var drop: String { + get { return Defaults[.drop] } + set { Defaults[.drop] = newValue } + } + + @objc dynamic var pop: String { + get { return Defaults[.pop] } + set { Defaults[.pop] = newValue } + } + + @objc dynamic var mbytes: String { + get { return Defaults[.mbytes] } + set { Defaults[.mbytes] = newValue } + } + + @objc dynamic var minutes: String { + get { return Defaults[.minutes] } + set { Defaults[.minutes] = newValue } + } + override func viewDidLoad() { super.viewDidLoad() // Do view setup here. diff --git a/EhautX/Views/AdvancedPrefsViewController.xib b/EhautX/Views/AdvancedPrefsViewController.xib index e360abc..11dafe6 100644 --- a/EhautX/Views/AdvancedPrefsViewController.xib +++ b/EhautX/Views/AdvancedPrefsViewController.xib @@ -14,60 +14,377 @@ - + - - + + - - + + - + - - + + - - + + - + - - + + - + + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + diff --git a/EhautX/Views/GeneralPrefsViewController.swift b/EhautX/Views/GeneralPrefsViewController.swift index c1b9966..921c1a9 100644 --- a/EhautX/Views/GeneralPrefsViewController.swift +++ b/EhautX/Views/GeneralPrefsViewController.swift @@ -25,6 +25,11 @@ class GeneralPrefsViewController: NSViewController, PreferencePane { set { Defaults[.password] = newValue } } + @objc dynamic var timeout: Int { + get { return Defaults[.timeout] } + set { Defaults[.timeout] = newValue } + } + override func viewDidLoad() { super.viewDidLoad() // Do view setup here. diff --git a/EhautX/Views/GeneralPrefsViewController.xib b/EhautX/Views/GeneralPrefsViewController.xib index c2ff386..b0e2c3c 100644 --- a/EhautX/Views/GeneralPrefsViewController.xib +++ b/EhautX/Views/GeneralPrefsViewController.xib @@ -14,11 +14,11 @@ - + - + @@ -30,7 +30,7 @@ - + @@ -42,7 +42,7 @@ - + @@ -54,7 +54,7 @@ - + @@ -69,7 +69,7 @@ - + @@ -83,24 +83,69 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + - + - +