2021-01-01 10:13:41 +00:00
|
|
|
//
|
|
|
|
// HostServiceView.swift
|
2021-01-01 16:53:28 +00:00
|
|
|
// Passepartout
|
2021-01-01 10:13:41 +00:00
|
|
|
//
|
|
|
|
// Created by Davide De Rosa on 6/13/19.
|
|
|
|
// Copyright (c) 2021 Davide De Rosa. All rights reserved.
|
|
|
|
//
|
|
|
|
// https://github.com/passepartoutvpn
|
|
|
|
//
|
|
|
|
// This file is part of Passepartout.
|
|
|
|
//
|
|
|
|
// Passepartout is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
// (at your option) any later version.
|
|
|
|
//
|
|
|
|
// Passepartout is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
// along with Passepartout. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
//
|
|
|
|
|
|
|
|
import Cocoa
|
2021-10-27 16:47:08 +00:00
|
|
|
import PassepartoutConstants
|
2021-01-01 10:13:41 +00:00
|
|
|
import PassepartoutCore
|
|
|
|
|
2021-06-26 07:49:48 +00:00
|
|
|
protocol HostServiceViewDelegate: AnyObject {
|
2021-01-01 10:13:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
class HostServiceView: NSView {
|
|
|
|
@IBOutlet private weak var labelAddressesCaption: NSTextField!
|
|
|
|
|
|
|
|
@IBOutlet private weak var tableAddresses: NSTableView!
|
|
|
|
|
|
|
|
var isEnabled: Bool = true {
|
|
|
|
didSet {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
var profile: HostConnectionProfile? {
|
|
|
|
didSet {
|
|
|
|
tableAddresses.reloadData()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
weak var delegate: HostServiceViewDelegate?
|
|
|
|
|
|
|
|
override func viewWillMove(toSuperview newSuperview: NSView?) {
|
|
|
|
super.viewWillMove(toSuperview: newSuperview)
|
|
|
|
|
2021-08-07 11:57:22 +00:00
|
|
|
labelAddressesCaption.stringValue = L10n.Service.Cells.Addresses.caption.asCaption
|
2021-01-01 10:13:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func reloadData() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
extension HostServiceView: NSTableViewDataSource, NSTableViewDelegate {
|
|
|
|
func numberOfRows(in tableView: NSTableView) -> Int {
|
|
|
|
guard let profile = profile else {
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
return profile.addresses.count
|
|
|
|
}
|
|
|
|
|
|
|
|
func tableView(_ tableView: NSTableView, objectValueFor tableColumn: NSTableColumn?, row: Int) -> Any? {
|
|
|
|
guard let profile = profile else {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
return profile.addresses[row]
|
|
|
|
}
|
|
|
|
|
|
|
|
func tableView(_ tableView: NSTableView, setObjectValue object: Any?, for tableColumn: NSTableColumn?, row: Int) {
|
|
|
|
}
|
|
|
|
}
|