Browse Source

minor changes.

pull/92/head
Abhishek 4 years ago
parent
commit
908e242143
  1. 19
      Clocker/Panel/Data Layer/TimezoneData.swift
  2. 19
      Clocker/Panel/Notes Popover/NotesPopover.swift
  3. 6
      Clocker/Panel/Notes Popover/NotesPopover.xib

19
Clocker/Panel/Data Layer/TimezoneData.swift

@ -28,14 +28,14 @@ class TimezoneData: NSObject, NSCoding {
enum TimezoneOverride: Int { enum TimezoneOverride: Int {
case globalFormat = 0 case globalFormat = 0
case twelveHourFormat case twelveHourFormat = 1
case twentyFourFormat case twentyFourFormat = 2
case twelveHourWithSeconds case twelveHourWithSeconds = 4
case twentyHourWithSeconds case twentyHourWithSeconds = 5
case twelveHourPrecedingZero case twelveHourPrecedingZero = 7
case twelveHourPrecedingZeroSeconds case twelveHourPrecedingZeroSeconds = 8
case twelveHourWithoutSuffix case twelveHourWithoutSuffix = 10
case twelveHourWithoutSuffixAndSeconds case twelveHourWithoutSuffixAndSeconds = 11
} }
static let values = [ static let values = [
@ -335,6 +335,7 @@ class TimezoneData: NSObject, NSCoding {
} else if shouldOverride == 4 { } else if shouldOverride == 4 {
overrideFormat = .twelveHourWithSeconds overrideFormat = .twelveHourWithSeconds
} else if shouldOverride == 5 { } else if shouldOverride == 5 {
print("Setting override format to five")
overrideFormat = .twentyHourWithSeconds overrideFormat = .twentyHourWithSeconds
} else if shouldOverride == 7 { } else if shouldOverride == 7 {
overrideFormat = .twelveHourPrecedingZero overrideFormat = .twelveHourPrecedingZero
@ -344,6 +345,8 @@ class TimezoneData: NSObject, NSCoding {
overrideFormat = .twelveHourWithoutSuffix overrideFormat = .twelveHourWithoutSuffix
} else if shouldOverride == 11 { } else if shouldOverride == 11 {
overrideFormat = .twelveHourWithoutSuffixAndSeconds overrideFormat = .twelveHourWithoutSuffixAndSeconds
} else {
assertionFailure("Chosen a wrong timezone format")
} }
} }

19
Clocker/Panel/Notes Popover/NotesPopover.swift

@ -38,6 +38,18 @@ class NotesPopover: NSViewController {
@IBOutlet var notesTextView: TextViewWithPlaceholder! @IBOutlet var notesTextView: TextViewWithPlaceholder!
private func convertOverrideFormatToPopupControlSelection() -> Int {
var chosenFormat: Int = dataObject?.overrideFormat.rawValue ?? 0
if chosenFormat == 3 {
chosenFormat = 4
} else if chosenFormat == 6 {
chosenFormat = 7
} else if chosenFormat == 9 {
chosenFormat = 10
}
return chosenFormat
}
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
@ -67,7 +79,6 @@ class NotesPopover: NSViewController {
alertPopupButton.selectItem(at: 1) alertPopupButton.selectItem(at: 1)
// Set up time control // Set up time control
let chosenFormat: Int = dataObject?.overrideFormat.rawValue ?? 0
let supportedTimeFormats = ["Respect Global Preference", let supportedTimeFormats = ["Respect Global Preference",
"h:mm a (7:08 PM)", "h:mm a (7:08 PM)",
"HH:mm (19:08)", "HH:mm (19:08)",
@ -87,7 +98,7 @@ class NotesPopover: NSViewController {
timeFormatControl.item(at: 6)?.isEnabled = false timeFormatControl.item(at: 6)?.isEnabled = false
timeFormatControl.item(at: 9)?.isEnabled = false timeFormatControl.item(at: 9)?.isEnabled = false
timeFormatControl.autoenablesItems = false timeFormatControl.autoenablesItems = false
timeFormatControl.selectItem(at: chosenFormat) timeFormatControl.selectItem(at: convertOverrideFormatToPopupControlSelection())
// Set Accessibility Identifiers for UI tests // Set Accessibility Identifiers for UI tests
customLabel.setAccessibilityIdentifier("CustomLabel") customLabel.setAccessibilityIdentifier("CustomLabel")
@ -474,9 +485,7 @@ extension NotesPopover {
} }
private func updateTimeFormat() { private func updateTimeFormat() {
if let overrideFormat = dataObject?.overrideFormat.rawValue { timeFormatControl.selectItem(at: convertOverrideFormatToPopupControlSelection())
timeFormatControl.selectItem(at: overrideFormat)
}
} }
private func enableReminderView(_ shouldEnable: Bool) { private func enableReminderView(_ shouldEnable: Bool) {

6
Clocker/Panel/Notes Popover/NotesPopover.xib

@ -186,10 +186,10 @@
<rect key="frame" x="0.0" y="77" width="300" height="60"/> <rect key="frame" x="0.0" y="77" width="300" height="60"/>
<subviews> <subviews>
<popUpButton verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="wso-Nb-JHM"> <popUpButton verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="wso-Nb-JHM">
<rect key="frame" x="17" y="6" width="267" height="25"/> <rect key="frame" x="17" y="6" width="277" height="25"/>
<popUpButtonCell key="cell" type="push" title="Item 1" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" selectedItem="8qk-GL-4hW" id="fxb-yT-8r3"> <popUpButtonCell key="cell" type="push" title="Item 1" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" selectedItem="8qk-GL-4hW" id="fxb-yT-8r3">
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/> <behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="menu"/> <font key="font" size="12" name="Avenir-Book"/>
<menu key="menu" id="cw0-En-hDs"> <menu key="menu" id="cw0-En-hDs">
<items> <items>
<menuItem title="Item 1" state="on" id="8qk-GL-4hW"/> <menuItem title="Item 1" state="on" id="8qk-GL-4hW"/>
@ -213,7 +213,7 @@
<constraint firstItem="Wqz-cF-lhm" firstAttribute="leading" secondItem="wso-Nb-JHM" secondAttribute="leading" id="6Nz-Pg-AjP"/> <constraint firstItem="Wqz-cF-lhm" firstAttribute="leading" secondItem="wso-Nb-JHM" secondAttribute="leading" id="6Nz-Pg-AjP"/>
<constraint firstAttribute="height" constant="60" id="6tP-1d-ufg"/> <constraint firstAttribute="height" constant="60" id="6tP-1d-ufg"/>
<constraint firstAttribute="trailing" secondItem="Wqz-cF-lhm" secondAttribute="trailing" constant="10" id="G6S-5h-12V"/> <constraint firstAttribute="trailing" secondItem="Wqz-cF-lhm" secondAttribute="trailing" constant="10" id="G6S-5h-12V"/>
<constraint firstAttribute="trailing" secondItem="wso-Nb-JHM" secondAttribute="trailing" constant="20" symbolic="YES" id="a7H-jo-4dw"/> <constraint firstAttribute="trailing" secondItem="wso-Nb-JHM" secondAttribute="trailing" constant="10" id="a7H-jo-4dw"/>
<constraint firstAttribute="bottom" secondItem="wso-Nb-JHM" secondAttribute="bottom" constant="10" id="uXh-0D-6O0"/> <constraint firstAttribute="bottom" secondItem="wso-Nb-JHM" secondAttribute="bottom" constant="10" id="uXh-0D-6O0"/>
<constraint firstAttribute="width" constant="300" id="xeM-Ue-etB"/> <constraint firstAttribute="width" constant="300" id="xeM-Ue-etB"/>
</constraints> </constraints>

Loading…
Cancel
Save