Version printed out

This commit is contained in:
Gerrit Linnemann 2016-12-28 08:52:03 +01:00
parent 6418b770dd
commit 8543405421
4 changed files with 44 additions and 27 deletions

View File

@ -760,7 +760,7 @@
<font key="font" metaFont="system"/>
<tabViewItems>
<tabViewItem label="Übersicht" identifier="1" id="MIJ-kl-tQe">
<view key="view" ambiguous="YES" id="3eX-zs-jOD">
<view key="view" id="3eX-zs-jOD">
<rect key="frame" x="0.0" y="0.0" width="738" height="479"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
@ -918,7 +918,7 @@
</subviews>
</clipView>
<scroller key="horizontalScroller" hidden="YES" verticalHuggingPriority="750" horizontal="YES" id="yAG-0l-MrF">
<rect key="frame" x="1" y="254" width="736" height="16"/>
<rect key="frame" x="1" y="-16" width="0.0" height="16"/>
<autoresizingMask key="autoresizingMask"/>
</scroller>
<scroller key="verticalScroller" hidden="YES" verticalHuggingPriority="750" horizontal="NO" id="0Mc-1B-cqp">
@ -1070,7 +1070,7 @@
</view>
</tabViewItem>
<tabViewItem label="Einstellungen" identifier="2" id="yzk-gj-wT8">
<view key="view" id="lU4-zL-hyv">
<view key="view" ambiguous="YES" id="lU4-zL-hyv">
<rect key="frame" x="0.0" y="0.0" width="738" height="479"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
@ -1180,6 +1180,15 @@
<action selector="saveSettingsAction:" target="XfG-lQ-9wD" id="X0N-0e-Aqk"/>
</connections>
</button>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="gMO-OO-HxJ">
<rect key="frame" x="18" y="22" width="50" height="17"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Version" id="N04-tF-zfQ">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
</subviews>
</view>
</tabViewItem>
@ -1188,6 +1197,7 @@
</subviews>
</view>
<connections>
<outlet property="lblVersion" destination="gMO-OO-HxJ" id="Yy2-7I-8cO"/>
<outlet property="tabView" destination="Zi9-hf-1KA" id="WBf-Lj-rLk"/>
<outlet property="ticketDetailsBox" destination="74T-Xv-xzg" id="42u-ME-evP"/>
<outlet property="ticketTableView" destination="uqq-D2-JrZ" id="Csb-WI-8ex"/>

View File

@ -27,33 +27,34 @@ extension ViewController: NSTableViewDataSource, NSTableViewDelegate {
var text: String = ""
var cellIdentifier: String = ""
guard row < OTRS.sharedInstance.ticketDictionary.count,
let item:Ticket = OTRS.sharedInstance.ticketDictionary[row] else {
guard row < OTRS.sharedInstance.ticketDictionary.count else {
return nil
}
if tableColumn == self.ticketTableView.tableColumns[0] {
cellIdentifier = CellIdentifiers.OTRSTicketNumber
image = nil
text = item.created.timeAgo
} else if tableColumn == self.ticketTableView.tableColumns[1] {
cellIdentifier = CellIdentifiers.OTRSTicketDetails
image = nil
text = item.owner
} else if tableColumn == self.ticketTableView.tableColumns[2] {
cellIdentifier = CellIdentifiers.OTRSTicketDetails
image = nil
text = item.title
} else if tableColumn == self.ticketTableView.tableColumns[3] {
cellIdentifier = CellIdentifiers.OTRSTicketState
image = nil
text = item.state.rawValue
}
if let item:Ticket = OTRS.sharedInstance.ticketDictionary[row] as Ticket {
if tableColumn == self.ticketTableView.tableColumns[0] {
cellIdentifier = CellIdentifiers.OTRSTicketNumber
image = nil
text = item.created.timeAgo
} else if tableColumn == self.ticketTableView.tableColumns[1] {
cellIdentifier = CellIdentifiers.OTRSTicketDetails
image = nil
text = item.owner
} else if tableColumn == self.ticketTableView.tableColumns[2] {
cellIdentifier = CellIdentifiers.OTRSTicketDetails
image = nil
text = item.title
} else if tableColumn == self.ticketTableView.tableColumns[3] {
cellIdentifier = CellIdentifiers.OTRSTicketState
image = nil
text = item.state.rawValue
}
if let cell = tableView.make(withIdentifier: cellIdentifier, owner: nil) as? NSTableCellView {
cell.textField?.stringValue = text
cell.imageView?.image = image ?? nil
return cell
if let cell = tableView.make(withIdentifier: cellIdentifier, owner: nil) as? NSTableCellView {
cell.textField?.stringValue = text
cell.imageView?.image = image ?? nil
return cell
}
}
return nil

View File

@ -26,11 +26,17 @@ class ViewController: NSViewController {
@IBOutlet weak var txtTicketCreatedBy: NSTextField!
@IBOutlet weak var txtTicketPriority: NSTextField!
@IBOutlet weak var lblVersion: NSTextField!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
if let version = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String {
self.lblVersion.stringValue = version
}
ticketTableView.delegate = self
ticketTableView.dataSource = self