Skip to content

Commit

Permalink
Adds version/build number to Preferences window.
Browse files Browse the repository at this point in the history
  • Loading branch information
nhojb committed Aug 26, 2020
1 parent 3c7755a commit b14c2aa
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 18 deletions.
54 changes: 36 additions & 18 deletions SyncthingBar/Base.lproj/PreferencesWindow.xib
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="16097.2" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="17154" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="16097.2"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="17154"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
Expand All @@ -11,21 +11,22 @@
<outlet property="apiKeyTextField" destination="tSG-AX-e5v" id="d69-ne-anf"/>
<outlet property="syncthingPathTextField" destination="hgw-L4-p6j" id="DSw-mQ-nJV"/>
<outlet property="urlTextField" destination="rIk-JM-sCP" id="BZH-rg-YDC"/>
<outlet property="versionLabel" destination="cAY-To-oYb" id="MYh-ao-4LP"/>
<outlet property="window" destination="QvC-M9-y7g" id="VyX-oi-cXG"/>
</connections>
</customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<window title="Preferences" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" animationBehavior="default" id="QvC-M9-y7g">
<windowStyleMask key="styleMask" titled="YES" closable="YES"/>
<rect key="contentRect" x="196" y="240" width="454" height="249"/>
<rect key="screenRect" x="0.0" y="0.0" width="2560" height="1417"/>
<view key="contentView" wantsLayer="YES" misplaced="YES" id="EiT-Mj-1SZ">
<rect key="frame" x="0.0" y="0.0" width="498" height="249"/>
<rect key="contentRect" x="196" y="240" width="498" height="282"/>
<rect key="screenRect" x="0.0" y="0.0" width="2560" height="1415"/>
<view key="contentView" wantsLayer="YES" id="EiT-Mj-1SZ">
<rect key="frame" x="0.0" y="0.0" width="498" height="287"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<stackView distribution="fill" orientation="horizontal" alignment="top" horizontalStackHuggingPriority="249.99998474121094" verticalStackHuggingPriority="249.99998474121094" detachesHiddenViews="YES" translatesAutoresizingMaskIntoConstraints="NO" id="3dw-nj-l8m">
<rect key="frame" x="20" y="208" width="458" height="21"/>
<rect key="frame" x="20" y="246" width="458" height="21"/>
<subviews>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="su4-Zc-f0U">
<rect key="frame" x="-2" y="5" width="98" height="16"/>
Expand Down Expand Up @@ -61,7 +62,7 @@
</customSpacing>
</stackView>
<stackView distribution="fill" orientation="horizontal" alignment="top" horizontalStackHuggingPriority="249.99998474121094" verticalStackHuggingPriority="249.99998474121094" detachesHiddenViews="YES" translatesAutoresizingMaskIntoConstraints="NO" id="o2a-IA-IJx">
<rect key="frame" x="20" y="167" width="458" height="21"/>
<rect key="frame" x="20" y="205" width="458" height="21"/>
<subviews>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="gzX-To-8hf">
<rect key="frame" x="-2" y="5" width="98" height="16"/>
Expand Down Expand Up @@ -97,18 +98,18 @@
</customSpacing>
</stackView>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="QMO-Tt-PwB">
<rect key="frame" x="18" y="110" width="100" height="16"/>
<rect key="frame" x="18" y="148" width="100" height="16"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="right" title="Syncthing Path:" id="GSQ-RV-UhE">
<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>
<stackView distribution="fill" orientation="horizontal" alignment="top" horizontalStackHuggingPriority="249.99998474121094" verticalStackHuggingPriority="249.99998474121094" detachesHiddenViews="YES" translatesAutoresizingMaskIntoConstraints="NO" id="ZTI-6o-bU3">
<rect key="frame" x="124" y="105" width="354" height="21"/>
<rect key="frame" x="124" y="144" width="354" height="20"/>
<subviews>
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="hgw-L4-p6j">
<rect key="frame" x="-2" y="5" width="275" height="16"/>
<rect key="frame" x="-2" y="4" width="271" height="16"/>
<textFieldCell key="cell" lineBreakMode="truncatingHead" title="/usr/local/bin/syncthing" id="VX7-Fi-pBC">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
Expand All @@ -119,7 +120,7 @@
</connections>
</textField>
<button horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="4tc-rp-wFt">
<rect key="frame" x="273" y="-7" width="87" height="32"/>
<rect key="frame" x="268" y="-7" width="93" height="32"/>
<buttonCell key="cell" type="push" title="Choose" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="Esn-S7-LcA">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
Expand All @@ -139,10 +140,10 @@
</customSpacing>
</stackView>
<box verticalHuggingPriority="750" boxType="separator" translatesAutoresizingMaskIntoConstraints="NO" id="3Zs-Gt-m8j">
<rect key="frame" x="0.0" y="56" width="498" height="5"/>
<rect key="frame" x="0.0" y="93" width="498" height="5"/>
</box>
<button translatesAutoresizingMaskIntoConstraints="NO" id="f02-e0-XOD">
<rect key="frame" x="122" y="77" width="129" height="18"/>
<rect key="frame" x="122" y="115" width="133" height="18"/>
<buttonCell key="cell" type="check" title="Launch syncthing" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="ygO-Lk-1NY">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/>
Expand All @@ -157,13 +158,13 @@
</connections>
</button>
<box verticalHuggingPriority="750" boxType="separator" translatesAutoresizingMaskIntoConstraints="NO" id="VZV-rk-zKZ">
<rect key="frame" x="0.0" y="144" width="498" height="5"/>
<rect key="frame" x="0.0" y="182" width="498" height="5"/>
<constraints>
<constraint firstAttribute="height" constant="1" id="qpJ-B4-z7M"/>
</constraints>
</box>
<button translatesAutoresizingMaskIntoConstraints="NO" id="aDV-rv-aYy">
<rect key="frame" x="122" y="22" width="192" height="18"/>
<rect key="frame" x="122" y="58" width="196" height="18"/>
<buttonCell key="cell" type="check" title="Open Syncthing Bar at login" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="qfm-rd-jbT">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/>
Expand All @@ -172,28 +173,45 @@
<binding destination="gtQ-Qw-l9o" name="value" keyPath="self.startAtLogin" id="WCW-Fu-bFL"/>
</connections>
</button>
<box verticalHuggingPriority="750" boxType="separator" translatesAutoresizingMaskIntoConstraints="NO" id="4tm-Mo-jQf">
<rect key="frame" x="0.0" y="36" width="498" height="5"/>
</box>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="cAY-To-oYb">
<rect key="frame" x="227" y="12" width="44" height="14"/>
<textFieldCell key="cell" controlSize="small" lineBreakMode="clipping" title="Version" id="36t-1l-WO9">
<font key="font" metaFont="smallSystem"/>
<color key="textColor" name="secondaryLabelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
</subviews>
<constraints>
<constraint firstAttribute="trailing" secondItem="ZTI-6o-bU3" secondAttribute="trailing" constant="20" id="2Ho-of-NPe"/>
<constraint firstItem="cAY-To-oYb" firstAttribute="centerX" secondItem="EiT-Mj-1SZ" secondAttribute="centerX" id="5Yk-Al-cwv"/>
<constraint firstItem="gzX-To-8hf" firstAttribute="trailing" secondItem="su4-Zc-f0U" secondAttribute="trailing" id="6TA-XS-n19"/>
<constraint firstAttribute="trailing" secondItem="VZV-rk-zKZ" secondAttribute="trailing" id="6cl-bU-MVz"/>
<constraint firstItem="cAY-To-oYb" firstAttribute="top" secondItem="4tm-Mo-jQf" secondAttribute="bottom" constant="12" id="AEP-dS-KNe"/>
<constraint firstItem="ZTI-6o-bU3" firstAttribute="top" secondItem="QMO-Tt-PwB" secondAttribute="top" id="Bes-20-52e"/>
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="aDV-rv-aYy" secondAttribute="trailing" constant="20" id="DBb-Cb-Dzv"/>
<constraint firstItem="aDV-rv-aYy" firstAttribute="leading" secondItem="f02-e0-XOD" secondAttribute="leading" id="EIj-5t-Y8o"/>
<constraint firstAttribute="bottom" relation="greaterThanOrEqual" secondItem="aDV-rv-aYy" secondAttribute="bottom" constant="20" id="F19-l9-8cy"/>
<constraint firstAttribute="trailing" secondItem="3dw-nj-l8m" secondAttribute="trailing" constant="20" id="F5X-NE-vk5"/>
<constraint firstAttribute="bottom" relation="greaterThanOrEqual" secondItem="aDV-rv-aYy" secondAttribute="bottom" constant="20" id="HPJ-SM-LFx"/>
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="f02-e0-XOD" secondAttribute="trailing" constant="20" id="Hwa-4n-Sb0"/>
<constraint firstAttribute="bottom" secondItem="cAY-To-oYb" secondAttribute="bottom" constant="12" id="J4U-Aw-pri"/>
<constraint firstItem="o2a-IA-IJx" firstAttribute="top" secondItem="3dw-nj-l8m" secondAttribute="bottom" constant="20" id="K7Q-JE-OMA"/>
<constraint firstItem="QMO-Tt-PwB" firstAttribute="top" secondItem="VZV-rk-zKZ" secondAttribute="bottom" constant="20" id="LQe-ar-TbH"/>
<constraint firstAttribute="trailing" secondItem="3Zs-Gt-m8j" secondAttribute="trailing" id="NI1-Dm-dOm"/>
<constraint firstItem="o2a-IA-IJx" firstAttribute="leading" secondItem="EiT-Mj-1SZ" secondAttribute="leading" constant="20" id="Nfn-dG-izN"/>
<constraint firstAttribute="trailing" secondItem="4tm-Mo-jQf" secondAttribute="trailing" id="QVL-gR-gk6"/>
<constraint firstItem="QMO-Tt-PwB" firstAttribute="leading" secondItem="EiT-Mj-1SZ" secondAttribute="leading" constant="20" id="Qgk-v6-TSD"/>
<constraint firstItem="ZTI-6o-bU3" firstAttribute="leading" secondItem="QMO-Tt-PwB" secondAttribute="trailing" constant="8" id="ZO0-gb-2MI"/>
<constraint firstItem="3Zs-Gt-m8j" firstAttribute="leading" secondItem="EiT-Mj-1SZ" secondAttribute="leading" id="ct7-Of-c54"/>
<constraint firstItem="3Zs-Gt-m8j" firstAttribute="top" secondItem="f02-e0-XOD" secondAttribute="bottom" constant="20" id="dUa-Qq-Cjq"/>
<constraint firstItem="aDV-rv-aYy" firstAttribute="top" secondItem="3Zs-Gt-m8j" secondAttribute="bottom" constant="20" id="etr-ql-hWt"/>
<constraint firstItem="VZV-rk-zKZ" firstAttribute="top" secondItem="o2a-IA-IJx" secondAttribute="bottom" constant="20" id="g34-Fs-DWo"/>
<constraint firstAttribute="trailing" secondItem="o2a-IA-IJx" secondAttribute="trailing" constant="20" id="hzA-Ug-4zc"/>
<constraint firstItem="4tm-Mo-jQf" firstAttribute="leading" secondItem="EiT-Mj-1SZ" secondAttribute="leading" id="jn7-0e-h3Y"/>
<constraint firstItem="4tm-Mo-jQf" firstAttribute="top" secondItem="aDV-rv-aYy" secondAttribute="bottom" constant="20" id="jz4-ww-AaX"/>
<constraint firstItem="f02-e0-XOD" firstAttribute="leading" secondItem="ZTI-6o-bU3" secondAttribute="leading" id="nAC-Dr-gaO"/>
<constraint firstItem="f02-e0-XOD" firstAttribute="top" secondItem="ZTI-6o-bU3" secondAttribute="bottom" constant="12" id="tRX-Ri-TZ9"/>
<constraint firstItem="3dw-nj-l8m" firstAttribute="top" secondItem="EiT-Mj-1SZ" secondAttribute="top" constant="20" id="uK2-9d-9BK"/>
Expand All @@ -204,7 +222,7 @@
<connections>
<outlet property="delegate" destination="-2" id="zhF-EJ-pcD"/>
</connections>
<point key="canvasLocation" x="-159" y="99.5"/>
<point key="canvasLocation" x="-159" y="116"/>
</window>
<userDefaultsController representsSharedInstance="YES" id="ec4-6Y-kvp"/>
<customObject id="gtQ-Qw-l9o" customClass="LoginItemsManager" customModule="LoginItems"/>
Expand Down
14 changes: 14 additions & 0 deletions SyncthingBar/PreferencesWindowController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,20 @@ class PreferencesWindowController: NSWindowController {

@IBOutlet weak var syncthingPathTextField: NSTextField!

@IBOutlet weak var versionLabel: NSTextField!

override func windowDidLoad() {
super.windowDidLoad()

if let build = Bundle.main.object(forInfoDictionaryKey: "CFBundleVersion") as? String,
let version = Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") as? String {
self.versionLabel.stringValue = "Syncthing Bar v\(version) (\(build))"
self.versionLabel.isHidden = false
} else {
self.versionLabel.isHidden = true
}
}

@objc
func windowWillClose(_ notification: Notification) {
// Ensure we sync UserDefaults: bindings do not update when the window closes.
Expand Down

0 comments on commit b14c2aa

Please sign in to comment.