Browse Source

New changes.

pull/101/head
Abhishek 3 years ago
parent
commit
47a24d5ee5
  1. 20
      Clocker/Clocker/en.lproj/Panel.xib
  2. 8
      Clocker/Overall App/Themer.swift
  3. 1
      Clocker/Panel/PanelController.swift
  4. 33
      Clocker/Panel/ParentPanelController+ModernSlider.swift
  5. 3
      Clocker/Panel/ParentPanelController.swift

20
Clocker/Clocker/en.lproj/Panel.xib

@ -22,6 +22,7 @@
<outlet property="modernSliderLabel" destination="e2d-EI-Dm0" id="eby-rL-B21"/> <outlet property="modernSliderLabel" destination="e2d-EI-Dm0" id="eby-rL-B21"/>
<outlet property="pinButton" destination="YXE-4J-5cn" id="k6V-HK-7XG"/> <outlet property="pinButton" destination="YXE-4J-5cn" id="k6V-HK-7XG"/>
<outlet property="preferencesButton" destination="Ctq-BV-GPN" id="cdL-5h-qmx"/> <outlet property="preferencesButton" destination="Ctq-BV-GPN" id="cdL-5h-qmx"/>
<outlet property="resetModernSliderButton" destination="TK5-db-7bd" id="kFe-rX-u1L"/>
<outlet property="reviewView" destination="TDn-Kk-KkV" id="YdI-Y4-zrg"/> <outlet property="reviewView" destination="TDn-Kk-KkV" id="YdI-Y4-zrg"/>
<outlet property="rightButton" destination="w3d-CG-aBO" id="rcF-Gw-CtM"/> <outlet property="rightButton" destination="w3d-CG-aBO" id="rcF-Gw-CtM"/>
<outlet property="roundedDateView" destination="I2Z-NZ-795" id="Oa9-q9-gZx"/> <outlet property="roundedDateView" destination="I2Z-NZ-795" id="Oa9-q9-gZx"/>
@ -261,7 +262,7 @@
</scroller> </scroller>
</scrollView> </scrollView>
<customView wantsLayer="YES" focusRingType="none" translatesAutoresizingMaskIntoConstraints="NO" id="C7R-Dq-MFr" userLabel="Slider View"> <customView wantsLayer="YES" focusRingType="none" translatesAutoresizingMaskIntoConstraints="NO" id="C7R-Dq-MFr" userLabel="Slider View">
<rect key="frame" x="0.0" y="245" width="350" height="30"/> <rect key="frame" x="0.0" y="155" width="350" height="30"/>
<subviews> <subviews>
<slider verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Vf2-uI-yf3"> <slider verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Vf2-uI-yf3">
<rect key="frame" x="7" y="2" width="201" height="23"/> <rect key="frame" x="7" y="2" width="201" height="23"/>
@ -364,6 +365,20 @@
<constraint firstAttribute="trailing" secondItem="e2d-EI-Dm0" secondAttribute="trailing" id="vFB-mV-hbB"/> <constraint firstAttribute="trailing" secondItem="e2d-EI-Dm0" secondAttribute="trailing" id="vFB-mV-hbB"/>
</constraints> </constraints>
</customView> </customView>
<button wantsLayer="YES" translatesAutoresizingMaskIntoConstraints="NO" id="TK5-db-7bd">
<rect key="frame" x="220" y="15" width="15" height="15"/>
<constraints>
<constraint firstAttribute="width" constant="15" id="JkE-Dc-CMn"/>
<constraint firstAttribute="height" constant="15" id="U52-GS-JMp"/>
</constraints>
<buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" image="PowerIcon-White" imagePosition="only" alignment="center" imageScaling="proportionallyUpOrDown" inset="2" id="ba3-eN-C02">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<action selector="resetModernSlider:" target="-2" id="Nvd-lK-hK3"/>
</connections>
</button>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="aW8-hr-4Zh"> <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="aW8-hr-4Zh">
<rect key="frame" x="75" y="0.0" width="45" height="20"/> <rect key="frame" x="75" y="0.0" width="45" height="20"/>
<constraints> <constraints>
@ -407,6 +422,8 @@
<constraint firstAttribute="bottom" secondItem="hma-wI-Sc9" secondAttribute="bottom" id="TDr-Pa-iYA"/> <constraint firstAttribute="bottom" secondItem="hma-wI-Sc9" secondAttribute="bottom" id="TDr-Pa-iYA"/>
<constraint firstAttribute="bottom" secondItem="htc-pO-AqH" secondAttribute="bottom" priority="750" constant="30" id="YCJ-zB-dvc"/> <constraint firstAttribute="bottom" secondItem="htc-pO-AqH" secondAttribute="bottom" priority="750" constant="30" id="YCJ-zB-dvc"/>
<constraint firstAttribute="trailing" secondItem="htc-pO-AqH" secondAttribute="trailing" id="esR-My-uoD"/> <constraint firstAttribute="trailing" secondItem="htc-pO-AqH" secondAttribute="trailing" id="esR-My-uoD"/>
<constraint firstItem="hma-wI-Sc9" firstAttribute="top" secondItem="TK5-db-7bd" secondAttribute="bottom" constant="-5" id="pIb-qt-jKw"/>
<constraint firstItem="TK5-db-7bd" firstAttribute="trailing" secondItem="hma-wI-Sc9" secondAttribute="trailing" constant="10" id="yhv-uP-Oih"/>
</constraints> </constraints>
<accessibility identifier="Modern Slider Container"/> <accessibility identifier="Modern Slider Container"/>
</customView> </customView>
@ -663,6 +680,7 @@
<image name="Extra" width="700" height="700"/> <image name="Extra" width="700" height="700"/>
<image name="Float-White" width="15" height="13"/> <image name="Float-White" width="15" height="13"/>
<image name="PowerIcon" width="350" height="350"/> <image name="PowerIcon" width="350" height="350"/>
<image name="PowerIcon-White" width="350" height="350"/>
<image name="SharingDarkIcon" width="19" height="22"/> <image name="SharingDarkIcon" width="19" height="22"/>
<namedColor name="Accent Color"> <namedColor name="Accent Color">
<color red="0.092000000178813934" green="0.0" blue="0.99900001287460327" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <color red="0.092000000178813934" green="0.0" blue="0.99900001287460327" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>

8
Clocker/Overall App/Themer.swift

@ -210,8 +210,8 @@ extension Themer {
return return
themeIndex == .light themeIndex == .light
? NSImage(named: NSImage.Name("Settings"))! ? NSImage(named: NSImage.Name("Settings"))!
: NSImage(named: NSImage.Name("Settings-White"))! : NSImage(named: NSImage.Name("Settings-White"))!
} }
func pinImage() -> NSImage { func pinImage() -> NSImage {
@ -515,6 +515,10 @@ extension Themer {
return symbolImage(for: "goforward.15") return symbolImage(for: "goforward.15")
} }
func resetModernSliderImage() -> NSImage? {
return symbolImage(for: "xmark.circle.fill")
}
private func symbolImage(for name: String) -> NSImage? { private func symbolImage(for name: String) -> NSImage? {
assert(name.isEmpty == false) assert(name.isEmpty == false)

1
Clocker/Panel/PanelController.swift

@ -99,6 +99,7 @@ class PanelController: ParentPanelController {
sliderDatePicker.dateValue = Date() sliderDatePicker.dateValue = Date()
closestQuarterTimeRepresentation = findClosestQuarterTimeApproximation() closestQuarterTimeRepresentation = findClosestQuarterTimeApproximation()
modernSliderLabel.stringValue = "Time Scroller" modernSliderLabel.stringValue = "Time Scroller"
resetModernSliderButton.isHidden = true
if modernSlider != nil { if modernSlider != nil {
let indexPaths: Set<IndexPath> = Set([IndexPath(item: modernSlider.numberOfItems(inSection: 0) / 2, section: 0)]) let indexPaths: Set<IndexPath> = Set([IndexPath(item: modernSlider.numberOfItems(inSection: 0) / 2, section: 0)])

33
Clocker/Panel/ParentPanelController+ModernSlider.swift

@ -18,6 +18,8 @@ extension ParentPanelController: NSCollectionViewDataSource {
extension ParentPanelController { extension ParentPanelController {
func setupModernSliderIfNeccessary() { func setupModernSliderIfNeccessary() {
if modernSlider != nil { if modernSlider != nil {
resetModernSliderButton.image = Themer.shared().resetModernSliderImage()
goBackwardsButton.image = Themer.shared().goBackwardsImage() goBackwardsButton.image = Themer.shared().goBackwardsImage()
goForwardButton.image = Themer.shared().goForwardsImage() goForwardButton.image = Themer.shared().goForwardsImage()
@ -56,6 +58,27 @@ extension ParentPanelController {
navigateModernSliderToSpecificIndex(-1) navigateModernSliderToSpecificIndex(-1)
} }
private func animateButton(_ hidden: Bool) {
NSAnimationContext.runAnimationGroup({ context in
context.duration = 0.5
context.timingFunction = CAMediaTimingFunction(name: CAMediaTimingFunctionName.easeOut)
resetModernSliderButton.animator().alphaValue = hidden ? 0.0 : 1.0
}, completionHandler: { [weak self] in
guard let strongSelf = self else { return }
strongSelf.resetModernSliderButton.animator().isHidden = hidden
})
}
@IBAction func resetModernSlider(_: NSButton) {
closestQuarterTimeRepresentation = findClosestQuarterTimeApproximation()
modernSliderLabel.stringValue = "Time Scroller"
animateButton(true)
if modernSlider != nil {
let indexPaths: Set<IndexPath> = Set([IndexPath(item: modernSlider.numberOfItems(inSection: 0) / 2, section: 0)])
modernSlider.scrollToItems(at: indexPaths, scrollPosition: .centeredHorizontally)
}
}
private func navigateModernSliderToSpecificIndex(_ index: Int) { private func navigateModernSliderToSpecificIndex(_ index: Int) {
guard let contentView = modernSlider.superview as? NSClipView else { guard let contentView = modernSlider.superview as? NSClipView else {
return return
@ -101,14 +124,24 @@ extension ParentPanelController {
let remainder = (index % (centerPoint + 1)) let remainder = (index % (centerPoint + 1))
let nextDate = Calendar.current.date(byAdding: .minute, value: remainder * 15, to: closestQuarterTimeRepresentation ?? Date())! let nextDate = Calendar.current.date(byAdding: .minute, value: remainder * 15, to: closestQuarterTimeRepresentation ?? Date())!
modernSliderLabel.stringValue = timezoneFormattedStringRepresentation(nextDate) modernSliderLabel.stringValue = timezoneFormattedStringRepresentation(nextDate)
if resetModernSliderButton.isHidden {
animateButton(false)
}
return nextDate.minutes(from: Date()) + 1 return nextDate.minutes(from: Date()) + 1
} else if index < centerPoint { } else if index < centerPoint {
let remainder = centerPoint - index + 1 let remainder = centerPoint - index + 1
let previousDate = Calendar.current.date(byAdding: .minute, value: -1 * remainder * 15, to: closestQuarterTimeRepresentation ?? Date())! let previousDate = Calendar.current.date(byAdding: .minute, value: -1 * remainder * 15, to: closestQuarterTimeRepresentation ?? Date())!
modernSliderLabel.stringValue = timezoneFormattedStringRepresentation(previousDate) modernSliderLabel.stringValue = timezoneFormattedStringRepresentation(previousDate)
if resetModernSliderButton.isHidden {
animateButton(false)
}
return previousDate.minutes(from: Date()) return previousDate.minutes(from: Date())
} else { } else {
modernSliderLabel.stringValue = "Time Scroller" modernSliderLabel.stringValue = "Time Scroller"
if !resetModernSliderButton.isHidden {
animateButton(true)
}
return 0 return 0
} }
} }

3
Clocker/Panel/ParentPanelController.swift

@ -85,6 +85,7 @@ class ParentPanelController: NSWindowController {
@IBOutlet var modernContainerView: ModernSliderContainerView! @IBOutlet var modernContainerView: ModernSliderContainerView!
@IBOutlet var goBackwardsButton: NSButton! @IBOutlet var goBackwardsButton: NSButton!
@IBOutlet var goForwardButton: NSButton! @IBOutlet var goForwardButton: NSButton!
@IBOutlet var resetModernSliderButton: NSButton!
// Upcoming Events // Upcoming Events
@IBOutlet var upcomingEventCollectionView: NSCollectionView! @IBOutlet var upcomingEventCollectionView: NSCollectionView!
@ -997,7 +998,7 @@ class ParentPanelController: NSWindowController {
let localizeClocker = NSMenuItem(title: "Localize Clocker...", let localizeClocker = NSMenuItem(title: "Localize Clocker...",
action: #selector(openCrowdin), keyEquivalent: "") action: #selector(openCrowdin), keyEquivalent: "")
let openPreferences = NSMenuItem(title: "Preferences", let openPreferences = NSMenuItem(title: "Preferences",
action: #selector(openPreferencesWindow), keyEquivalent: "") action: #selector(openPreferencesWindow), keyEquivalent: "")
let appDisplayName = Bundle.main.object(forInfoDictionaryKey: "CFBundleDisplayName") ?? "Clocker" let appDisplayName = Bundle.main.object(forInfoDictionaryKey: "CFBundleDisplayName") ?? "Clocker"
let shortVersion = Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") ?? "N/A" let shortVersion = Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") ?? "N/A"

Loading…
Cancel
Save