mirror of
https://github.com/danbee/persephone
synced 2025-03-04 08:39:11 +00:00
Importing Cocoa pulls in CoreData, which we're not using. https://github.com/brentsimmons/NetNewsWire/blob/master/Technotes/CodingGuidelines.md
47 lines
1.2 KiB
Swift
47 lines
1.2 KiB
Swift
//
|
|
// PreferencesViewController.swift
|
|
// Persephone
|
|
//
|
|
// Created by Daniel Barber on 2019/2/14.
|
|
// Copyright © 2019 Dan Barber. All rights reserved.
|
|
//
|
|
|
|
import AppKit
|
|
import ReSwift
|
|
|
|
class GeneralPrefsViewController: NSViewController {
|
|
override func viewDidLoad() {
|
|
super.viewDidLoad()
|
|
|
|
if let mpdHost = AppDelegate.store.state.preferencesState.mpdServer.host {
|
|
mpdHostField.stringValue = mpdHost
|
|
}
|
|
|
|
if let mpdPort = AppDelegate.store.state.preferencesState.mpdServer.port {
|
|
print(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) {
|
|
AppDelegate.store.dispatch(UpdateServerHost(host: sender.stringValue))
|
|
}
|
|
|
|
@IBAction func updateMpdPort(_ sender: NSTextField) {
|
|
AppDelegate.store.dispatch(UpdateServerPort(port: sender.integerValue))
|
|
}
|
|
|
|
@IBOutlet var mpdHostField: NSTextField!
|
|
@IBOutlet var mpdPortField: NSTextField!
|
|
}
|