mirror of
https://github.com/danbee/persephone
synced 2025-03-04 08:39:11 +00:00
47 lines
1.0 KiB
Swift
47 lines
1.0 KiB
Swift
//
|
|
// PreferencesViewController.swift
|
|
// Persephone
|
|
//
|
|
// Created by Daniel Barber on 2019/2/14.
|
|
// Copyright © 2019 Dan Barber. All rights reserved.
|
|
//
|
|
|
|
import Cocoa
|
|
|
|
class GeneralPrefsViewController: NSViewController {
|
|
var preferences = Preferences()
|
|
|
|
override func viewDidLoad() {
|
|
super.viewDidLoad()
|
|
|
|
if let mpdHost = preferences.mpdHost {
|
|
mpdHostField.stringValue = mpdHost
|
|
}
|
|
|
|
if let mpdPort = preferences.mpdPort {
|
|
mpdPortField.stringValue = "\(mpdPort)"
|
|
}
|
|
|
|
preferredContentSize = NSMakeSize(view.frame.size.width, view.frame.size.height)
|
|
}
|
|
|
|
override func viewDidAppear() {
|
|
super.viewDidAppear()
|
|
|
|
guard let title = title
|
|
else { return }
|
|
self.parent?.view.window?.title = title
|
|
}
|
|
|
|
@IBAction func updateMpdHost(_ sender: NSTextField) {
|
|
preferences.mpdHost = sender.stringValue
|
|
}
|
|
|
|
@IBAction func updateMpdPort(_ sender: NSTextField) {
|
|
preferences.mpdPort = sender.integerValue
|
|
}
|
|
|
|
@IBOutlet var mpdHostField: NSTextField!
|
|
@IBOutlet var mpdPortField: NSTextField!
|
|
}
|