Browse Source

Remove shared()

pull/113/head
Abhishek 3 years ago
parent
commit
f65b1ea6c1
  1. 9
      Clocker/Preferences/App Feedback/AppFeedbackWindowController.swift
  2. 9
      Clocker/Preferences/OneWindowController.swift
  3. 52
      Clocker/Preferences/Preferences.storyboard

9
Clocker/Preferences/App Feedback/AppFeedbackWindowController.swift

@ -309,8 +309,13 @@ extension AppFeedbackWindowController: NSWindowDelegate {
}
func bringPreferencesWindowToFront() {
let oneWindowController = OneWindowController.shared()
oneWindowController.window?.makeKeyAndOrderFront(self)
let windows = NSApplication.shared.windows
let prefWindow = windows.first(where: { window in
return window.identifier == NSUserInterfaceItemIdentifier("Preferences")
})
if let prefW = prefWindow {
prefW.makeKeyAndOrderFront(self)
NSApp.activate(ignoringOtherApps: true)
}
}
}

9
Clocker/Preferences/OneWindowController.swift

@ -49,14 +49,7 @@ class OneWindowController: NSWindowController {
private func setupWindow() {
window?.titlebarAppearsTransparent = true
window?.backgroundColor = Themer.shared().mainBackgroundColor()
}
class func shared() -> OneWindowController {
if sharedWindow == nil {
let prefStoryboard = NSStoryboard(name: "Preferences", bundle: nil)
sharedWindow = prefStoryboard.instantiateInitialController() as? OneWindowController
}
return sharedWindow
window?.identifier = NSUserInterfaceItemIdentifier("Preferences")
}
func openPermissions() {

52
Clocker/Preferences/Preferences.storyboard

@ -801,7 +801,7 @@
<gridCells>
<gridCell row="3zv-Qe-ePN" column="ARE-A4-4k4" id="fRB-cT-Ydc">
<textField key="contentView" horizontalHuggingPriority="251" verticalHuggingPriority="750" preferredMaxLayoutWidth="100" translatesAutoresizingMaskIntoConstraints="NO" id="wtO-uL-QBf">
<rect key="frame" x="109" y="207" width="104" height="18"/>
<rect key="frame" x="98" y="207" width="104" height="18"/>
<constraints>
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="100" id="WNN-Le-h1b"/>
</constraints>
@ -814,7 +814,7 @@
</gridCell>
<gridCell row="3zv-Qe-ePN" column="YBI-pK-gPQ" id="QZh-9h-ecx">
<popUpButton key="contentView" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="iiG-Xu-4id">
<rect key="frame" x="228" y="202" width="78" height="25"/>
<rect key="frame" x="217" y="202" width="78" 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="5tQ-hE-OyI" id="rzx-jH-Vr6">
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="menu"/>
@ -834,7 +834,7 @@
</gridCell>
<gridCell row="YtR-o1-nGp" column="ARE-A4-4k4" id="gzZ-cp-CkC">
<textField key="contentView" horizontalHuggingPriority="251" verticalHuggingPriority="750" preferredMaxLayoutWidth="60" translatesAutoresizingMaskIntoConstraints="NO" id="vrm-cg-RMn">
<rect key="frame" x="112" y="167" width="101" height="18"/>
<rect key="frame" x="101" y="167" width="101" height="18"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="right" title="Panel Theme" id="ZKN-5V-B4D">
<font key="font" size="13" name="Avenir-Light"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
@ -844,7 +844,7 @@
</gridCell>
<gridCell row="YtR-o1-nGp" column="YBI-pK-gPQ" id="kQ8-mu-Ax8">
<popUpButton key="contentView" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="89w-KN-GJ6">
<rect key="frame" x="228" y="162" width="125" height="25"/>
<rect key="frame" x="217" y="162" width="125" height="25"/>
<popUpButtonCell key="cell" type="push" title="Light" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" selectedItem="xgz-r4-aaD" id="vql-m4-qSG">
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
<font key="font" size="13" name="Avenir-Book"/>
@ -865,7 +865,7 @@
</gridCell>
<gridCell row="vjb-Ch-BZs" column="ARE-A4-4k4" id="Tkw-Kt-dMr">
<textField key="contentView" horizontalHuggingPriority="251" verticalHuggingPriority="750" preferredMaxLayoutWidth="150" translatesAutoresizingMaskIntoConstraints="NO" id="gFE-hZ-J92">
<rect key="frame" x="29" y="126" width="184" height="18"/>
<rect key="frame" x="18" y="126" width="184" height="18"/>
<constraints>
<constraint firstAttribute="width" constant="180" id="SCi-hT-hxG"/>
</constraints>
@ -878,7 +878,7 @@
</gridCell>
<gridCell row="vjb-Ch-BZs" column="YBI-pK-gPQ" xPlacement="leading" yPlacement="none" id="Fnt-fn-6Wr">
<segmentedControl key="contentView" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="d4S-hM-MSP">
<rect key="frame" x="229" y="123" width="273" height="24"/>
<rect key="frame" x="218" y="123" width="273" height="24"/>
<segmentedCell key="cell" borderStyle="border" alignment="left" style="rounded" trackingMode="selectOne" id="564-Re-f1d">
<font key="font" size="12" name="Avenir-Light"/>
<segments>
@ -896,7 +896,7 @@
</gridCell>
<gridCell row="ad4-FM-AWq" column="ARE-A4-4k4" id="XeO-qn-EGI">
<textField key="contentView" horizontalHuggingPriority="251" verticalHuggingPriority="750" preferredMaxLayoutWidth="120" translatesAutoresizingMaskIntoConstraints="NO" id="4lt-X6-3uU">
<rect key="frame" x="9" y="84" width="204" height="18"/>
<rect key="frame" x="-2" y="84" width="204" height="18"/>
<constraints>
<constraint firstAttribute="width" constant="200" id="hAp-By-Lzj"/>
</constraints>
@ -909,7 +909,7 @@
</gridCell>
<gridCell row="ad4-FM-AWq" column="YBI-pK-gPQ" id="sA0-Dw-yO0">
<segmentedControl key="contentView" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="9WW-jp-NeO">
<rect key="frame" x="229" y="81" width="81" height="24"/>
<rect key="frame" x="218" y="81" width="81" height="24"/>
<segmentedCell key="cell" borderStyle="border" alignment="left" style="rounded" trackingMode="selectOne" id="CcB-5w-IoG">
<font key="font" size="12" name="Avenir-Light"/>
<segments>
@ -925,7 +925,7 @@
</gridCell>
<gridCell row="yUG-1W-BQ2" column="ARE-A4-4k4" id="M8P-5s-oL4">
<textField key="contentView" horizontalHuggingPriority="251" verticalHuggingPriority="750" preferredMaxLayoutWidth="120" translatesAutoresizingMaskIntoConstraints="NO" id="ZWy-WW-6H9">
<rect key="frame" x="50" y="42" width="163" height="18"/>
<rect key="frame" x="39" y="42" width="163" height="18"/>
<constraints>
<constraint firstAttribute="width" constant="159" id="NX0-Bo-SU8"/>
</constraints>
@ -938,7 +938,7 @@
</gridCell>
<gridCell row="yUG-1W-BQ2" column="YBI-pK-gPQ" id="N12-lC-Pe1">
<segmentedControl key="contentView" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="DCB-IB-UxK">
<rect key="frame" x="229" y="39" width="81" height="24"/>
<rect key="frame" x="218" y="39" width="81" height="24"/>
<segmentedCell key="cell" borderStyle="border" alignment="left" style="rounded" trackingMode="selectOne" id="PZZ-H7-LgV">
<font key="font" size="12" name="Avenir-Light"/>
<segments>
@ -954,7 +954,7 @@
</gridCell>
<gridCell row="fbk-ef-Req" column="ARE-A4-4k4" id="Vth-MP-nfS">
<textField key="contentView" horizontalHuggingPriority="251" verticalHuggingPriority="750" preferredMaxLayoutWidth="120" translatesAutoresizingMaskIntoConstraints="NO" id="xwt-pY-1w9">
<rect key="frame" x="9" y="1" width="204" height="18"/>
<rect key="frame" x="-2" y="1" width="204" height="18"/>
<constraints>
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="200" id="7fj-Em-Lyh"/>
</constraints>
@ -967,7 +967,7 @@
</gridCell>
<gridCell row="fbk-ef-Req" column="YBI-pK-gPQ" id="dCk-cz-no0">
<slider key="contentView" verticalHuggingPriority="750" alphaValue="0.59999999999999998" translatesAutoresizingMaskIntoConstraints="NO" id="3cU-IS-3Qu">
<rect key="frame" x="229" y="-6" width="104" height="28"/>
<rect key="frame" x="218" y="-6" width="104" height="28"/>
<sliderCell key="cell" state="on" alignment="left" minValue="4" maxValue="7" doubleValue="4" tickMarkPosition="above" numberOfTickMarks="4" allowsTickMarkValuesOnly="YES" sliderType="linear" id="eAh-k3-cof"/>
<connections>
<action selector="fontSliderChanged:" target="1aL-zR-8L4" id="YAW-aA-5aR"/>
@ -979,11 +979,11 @@
</gridView>
<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="70" y="39" 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="412" height="113"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<size key="intercellSpacing" width="3" height="2"/>
@ -1512,7 +1512,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="49" width="320" height="23"/>
<rect key="frame" x="8" y="265" width="320" 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"/>
@ -1569,13 +1569,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="320" height="9"/>
<rect key="frame" x="8" y="30" width="320" height="225"/>
<clipView key="contentView" drawsBackground="NO" id="rGc-3M-cCq">
<rect key="frame" x="0.0" y="0.0" width="320" height="9"/>
<rect key="frame" x="0.0" y="0.0" width="320" height="225"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<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="320" height="64"/>
<rect key="frame" x="0.0" y="0.0" width="320" height="225"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<size key="intercellSpacing" width="3" height="2"/>
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
@ -1665,14 +1665,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="160" y="54" width="16" height="16"/>
<rect key="frame" x="160" y="162" 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="24" width="300" height="22"/>
<rect key="frame" x="18" y="132" width="300" height="22"/>
<constraints>
<constraint firstAttribute="height" constant="22" id="zqt-d8-yas"/>
</constraints>
@ -1860,14 +1860,14 @@ DQ
<rect key="frame" x="0.0" y="0.0" width="618" height="52"/>
<subviews>
<button toolTip="Add a timezone" focusRingType="none" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="1FY-Nb-ZXb">
<rect key="frame" x="1" y="8" width="40" height="40"/>
<rect key="frame" x="1" y="6" width="40" height="40"/>
<constraints>
<constraint firstAttribute="width" constant="40" id="TJZ-Zv-ft0"/>
<constraint firstAttribute="height" constant="40" id="sK8-9i-bBo"/>
</constraints>
<buttonCell key="cell" type="smallSquare" bezelStyle="smallSquare" image="Add Icon" imagePosition="only" alignment="center" focusRingType="none" imageScaling="proportionallyDown" inset="2" id="AiB-Ig-MFT">
<behavior key="behavior" pushIn="YES" changeContents="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/>
<font key="font" metaFont="system" size="22"/>
</buttonCell>
<accessibility identifier="AddTimezone"/>
<connections>
@ -1875,10 +1875,10 @@ DQ
</connections>
</button>
<button toolTip="Remove a timezone" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="48a-Zz-oQg">
<rect key="frame" x="41" y="5" width="40" height="40"/>
<rect key="frame" x="41" y="6" width="40" height="40"/>
<buttonCell key="cell" type="smallSquare" bezelStyle="smallSquare" image="Remove" imagePosition="overlaps" alignment="center" state="on" imageScaling="proportionallyDown" inset="2" id="tPs-EW-qXq">
<behavior key="behavior" pushIn="YES" changeContents="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/>
<font key="font" metaFont="system" size="22"/>
<string key="keyEquivalent" base64-UTF8="YES">
CA
</string>
@ -1933,9 +1933,9 @@ CA
<constraint firstItem="aGE-ap-6NE" firstAttribute="centerY" secondItem="348-wa-XEI" secondAttribute="centerY" id="4Zi-tv-iUg"/>
<constraint firstItem="48a-Zz-oQg" firstAttribute="leading" secondItem="1FY-Nb-ZXb" secondAttribute="trailing" id="AUY-7G-gep"/>
<constraint firstItem="aCf-xC-UkE" firstAttribute="leading" secondItem="aGE-ap-6NE" secondAttribute="trailing" constant="8" id="Axm-NL-Rlj"/>
<constraint firstItem="1FY-Nb-ZXb" firstAttribute="centerY" secondItem="348-wa-XEI" secondAttribute="centerY" constant="-2" id="Iua-hE-fSo"/>
<constraint firstItem="1FY-Nb-ZXb" firstAttribute="centerY" secondItem="348-wa-XEI" secondAttribute="centerY" id="Iua-hE-fSo"/>
<constraint firstAttribute="trailing" secondItem="PbD-dt-goz" secondAttribute="trailing" constant="12" id="K40-ee-cJc"/>
<constraint firstItem="48a-Zz-oQg" firstAttribute="centerY" secondItem="348-wa-XEI" secondAttribute="centerY" constant="1" id="PDX-dP-7OB"/>
<constraint firstItem="48a-Zz-oQg" firstAttribute="centerY" secondItem="348-wa-XEI" secondAttribute="centerY" id="PDX-dP-7OB"/>
<constraint firstItem="aGE-ap-6NE" firstAttribute="leading" secondItem="48a-Zz-oQg" secondAttribute="trailing" constant="40" id="Qy7-CH-mDD"/>
<constraint firstItem="PbD-dt-goz" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="aCf-xC-UkE" secondAttribute="trailing" constant="20" id="S7R-11-bgf"/>
<constraint firstItem="aCf-xC-UkE" firstAttribute="centerY" secondItem="aGE-ap-6NE" secondAttribute="centerY" constant="-1.5" id="d8V-v9-JrU"/>

Loading…
Cancel
Save