Browse Source

Preview DST Transition info.

pull/92/head
Abhishek 4 years ago
parent
commit
96c1e5b915
  1. 15
      Clocker/Preferences/Appearance/AppearanceViewController.swift
  2. 25
      Clocker/Preferences/Preferences.storyboard

15
Clocker/Preferences/Appearance/AppearanceViewController.swift

@ -330,6 +330,10 @@ class AppearanceViewController: ParentViewController {
@IBAction func fontSliderChanged(_: Any) {
previewPanelTableView.reloadData()
}
@IBAction func toggleDSTTransitionOption(_: Any) {
previewPanelTableView.reloadData()
}
}
extension AppearanceViewController: NSTableViewDataSource, NSTableViewDelegate {
@ -356,8 +360,13 @@ extension AppearanceViewController: NSTableViewDataSource, NSTableViewDelegate {
cellView.rowNumber = row
cellView.customName.stringValue = currentModel.formattedTimezoneLabel()
cellView.time.stringValue = operation.time(with: 0)
cellView.noteLabel.stringValue = currentModel.note ?? CLEmptyString
cellView.noteLabel.toolTip = currentModel.note ?? CLEmptyString
if DataStore.shared().shouldDisplay(.dstTransitionInfo) {
cellView.noteLabel.stringValue = "Heads up! DST Transition will occur in 3 days."
} else if let note = currentModel.note, !note.isEmpty {
cellView.noteLabel.stringValue = note
} else {
cellView.noteLabel.stringValue = CLEmptyString
}
cellView.currentLocationIndicator.isHidden = !currentModel.isSystemTimezone
cellView.time.setAccessibilityIdentifier("ActualTime")
cellView.layout(with: currentModel)
@ -375,6 +384,8 @@ extension AppearanceViewController: NSTableViewDataSource, NSTableViewDelegate {
let rowHeight: Int = userFontSize == 4 ? 60 : 65
if let note = model.note, !note.isEmpty {
return CGFloat(rowHeight + userFontSize.intValue + 25)
} else if DataStore.shared().shouldDisplay(.dstTransitionInfo) {
return CGFloat(rowHeight + userFontSize.intValue + 25)
}
return CGFloat(rowHeight + (userFontSize.intValue * 2))

25
Clocker/Preferences/Preferences.storyboard

@ -908,6 +908,7 @@
</segments>
</segmentedCell>
<connections>
<action selector="toggleDSTTransitionOption:" target="1aL-zR-8L4" id="9bi-NL-gMv"/>
<binding destination="Gpv-Gr-MxZ" name="selectedIndex" keyPath="values.com.abhishek.showDSTTransitionInfo" id="eG0-sL-5hE"/>
</connections>
</segmentedControl>
@ -947,11 +948,11 @@
</slider>
<scrollView borderType="line" autohidesScrollers="YES" horizontalLineScroll="113" horizontalPageScroll="10" verticalLineScroll="113" verticalPageScroll="10" hasHorizontalScroller="NO" hasVerticalScroller="NO" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Ytg-0u-Mtu">
<rect key="frame" x="104" y="42" width="400" height="100"/>
<clipView key="contentView" ambiguous="YES" id="gnX-f5-31D">
<clipView key="contentView" id="gnX-f5-31D">
<rect key="frame" x="1" y="1" width="398" height="98"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<tableView verticalHuggingPriority="750" ambiguous="YES" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" multipleSelection="NO" emptySelection="NO" autosaveColumns="NO" typeSelect="NO" rowHeight="111" rowSizeStyle="automatic" viewBased="YES" id="KbJ-p4-i6E">
<tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" multipleSelection="NO" emptySelection="NO" autosaveColumns="NO" typeSelect="NO" rowHeight="111" rowSizeStyle="automatic" viewBased="YES" id="KbJ-p4-i6E">
<rect key="frame" x="0.0" y="0.0" width="398" height="113"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<size key="intercellSpacing" width="3" height="2"/>
@ -1521,7 +1522,7 @@
<autoresizingMask key="autoresizingMask"/>
<subviews>
<searchField toolTip="Search a timezone" wantsLayer="YES" focusRingType="none" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Dha-h9-Nd0" customClass="ClockerSearchField" customModule="Clocker" customModuleProvider="target">
<rect key="frame" x="8" y="73" width="329" height="23"/>
<rect key="frame" x="8" y="49" width="329" height="23"/>
<searchFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" borderStyle="bezel" focusRingType="none" placeholderString="Enter a city, state, country name" usesSingleLineMode="YES" maximumRecents="5" id="ikU-Tm-0WZ">
<font key="font" size="13" name="Avenir-Light"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
@ -1578,13 +1579,13 @@ DQ
</connections>
</button>
<scrollView focusRingType="none" borderType="none" autohidesScrollers="YES" horizontalLineScroll="32" horizontalPageScroll="10" verticalLineScroll="32" verticalPageScroll="10" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="0wY-ff-FLW">
<rect key="frame" x="8" y="30" width="329" height="33"/>
<rect key="frame" x="8" y="30" width="329" height="9"/>
<clipView key="contentView" drawsBackground="NO" id="rGc-3M-cCq">
<rect key="frame" x="0.0" y="0.0" width="329" height="33"/>
<rect key="frame" x="0.0" y="0.0" width="329" height="9"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<tableView focusRingType="none" verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" multipleSelection="NO" emptySelection="NO" autosaveColumns="NO" rowHeight="30" rowSizeStyle="automatic" viewBased="YES" id="xkl-2X-ZCb">
<rect key="frame" x="0.0" y="0.0" width="329" height="33"/>
<rect key="frame" x="0.0" y="0.0" width="329" height="9"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<size key="intercellSpacing" width="3" height="2"/>
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
@ -1674,14 +1675,14 @@ DQ
</scroller>
</scrollView>
<progressIndicator wantsLayer="YES" focusRingType="none" horizontalHuggingPriority="750" verticalHuggingPriority="750" maxValue="100" displayedWhenStopped="NO" bezeled="NO" indeterminate="YES" controlSize="small" style="spinning" translatesAutoresizingMaskIntoConstraints="NO" id="0A5-gp-lay">
<rect key="frame" x="165" y="66" width="16" height="16"/>
<rect key="frame" x="165" y="54" width="16" height="16"/>
<constraints>
<constraint firstAttribute="height" constant="16" id="fgE-77-Vda"/>
<constraint firstAttribute="width" constant="16" id="pwe-em-e0a"/>
</constraints>
</progressIndicator>
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="xgb-wU-8RU">
<rect key="frame" x="18" y="36" width="309" height="22"/>
<rect key="frame" x="18" y="24" width="309" height="22"/>
<constraints>
<constraint firstAttribute="height" constant="22" id="zqt-d8-yas"/>
</constraints>
@ -1729,7 +1730,7 @@ DQ
<rect key="frame" x="0.0" y="484" width="613" height="30"/>
<subviews>
<button toolTip="Sorts by time difference from your current timezone" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="P6d-qq-ycq">
<rect key="frame" x="277" y="3" width="13" height="25"/>
<rect key="frame" x="279" y="3" width="12" height="25"/>
<constraints>
<constraint firstAttribute="width" relation="lessThanOrEqual" constant="160" id="cAs-on-f7X"/>
<constraint firstAttribute="height" constant="25" id="juv-QL-vMx"/>
@ -1744,7 +1745,7 @@ DQ
</connections>
</button>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="0HL-uj-s4v">
<rect key="frame" x="333" y="3" width="13" height="25"/>
<rect key="frame" x="333" y="3" width="12" height="25"/>
<constraints>
<constraint firstAttribute="height" constant="25" id="eZL-Gr-38S"/>
<constraint firstAttribute="width" relation="lessThanOrEqual" constant="120" id="sJk-T7-7Lm"/>
@ -1759,7 +1760,7 @@ DQ
</connections>
</button>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="6fs-Mx-NcG">
<rect key="frame" x="305" y="3" width="13" height="25"/>
<rect key="frame" x="306" y="3" width="12" height="25"/>
<constraints>
<constraint firstAttribute="width" relation="lessThanOrEqual" constant="190" id="241-Rn-G6N"/>
<constraint firstAttribute="height" constant="25" id="weP-ll-vZ8"/>
@ -2013,7 +2014,7 @@ CA
<image name="ClockerIcon-512" width="1024" height="1024"/>
<image name="CurrentLocation" width="350" height="350"/>
<image name="Extra" width="700" height="700"/>
<image name="NSDescendingSortIndicator" width="9" height="9"/>
<image name="NSDescendingSortIndicator" width="8" height="8"/>
<image name="NSFontPanel" width="32" height="32"/>
<image name="NSInfo" width="32" height="32"/>
<image name="NSPreferencesGeneral" width="32" height="32"/>

Loading…
Cancel
Save