Skip to content

Commit

Permalink
Merge pull request #17 from qwertyyb/hotfix
Browse files Browse the repository at this point in the history
fix: add popover setting to avoid cpu problem
  • Loading branch information
qwertyyb authored Nov 16, 2019
2 parents c04f947 + ceac9d5 commit ff04dfb
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 62 deletions.
125 changes: 68 additions & 57 deletions YPaste/Base.lproj/Preferences.xib
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<window title="Preferences" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" animationBehavior="default" id="QvC-M9-y7g">
<windowStyleMask key="styleMask" titled="YES" closable="YES"/>
<rect key="contentRect" x="196" y="240" width="240" height="189"/>
<rect key="contentRect" x="196" y="240" width="246" height="229"/>
<rect key="screenRect" x="0.0" y="0.0" width="1680" height="1027"/>
<view key="contentView" wantsLayer="YES" id="EiT-Mj-1SZ">
<rect key="frame" x="0.0" y="0.0" width="240" height="189"/>
<rect key="frame" x="0.0" y="0.0" width="246" height="229"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<button verticalHuggingPriority="750" id="VWY-d8-NZM">
<rect key="frame" x="30" y="153" width="119" height="18"/>
<rect key="frame" x="30" y="193" width="119" height="18"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="check" title="Launch at Login" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="LeK-Xa-5ej">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
Expand All @@ -35,59 +35,8 @@
<binding destination="xQO-e6-7gF" name="value" keyPath="values.launchAtLogin" id="O8W-43-Un1"/>
</connections>
</button>
<stackView distribution="fill" orientation="horizontal" alignment="centerY" horizontalStackHuggingPriority="249.99998474121094" verticalStackHuggingPriority="249.99998474121094" detachesHiddenViews="YES" id="Jyb-Dr-tW1">
<rect key="frame" x="32" y="112" width="177" height="21"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<subviews>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="LPe-gb-72a" userLabel="Check Update">
<rect key="frame" x="-2" y="3" width="91" height="16"/>
<textFieldCell key="cell" lineBreakMode="clipping" title="Check Update" id="dWG-eZ-o58">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<popUpButton verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="KvF-RK-Ded" userLabel="UpdateInterval">
<rect key="frame" x="93" y="-3" width="87" height="25"/>
<popUpButtonCell key="cell" type="push" title="Hourly" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" tag="3600" imageScaling="proportionallyDown" inset="2" selectedItem="EE6-Ss-Gw7" id="IA7-J9-2tC">
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="menu"/>
<menu key="menu" id="g77-xz-TFH">
<items>
<menuItem title="Hourly" state="on" tag="3600" id="EE6-Ss-Gw7">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
<menuItem title="Daily" tag="86400" id="eEf-BQ-9PH">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
<menuItem title="Weekly" tag="604800" id="fcM-sZ-IDB">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
<menuItem title="Monthly" tag="2629800" id="Lew-rN-naA">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
<menuItem title="Never" id="3TG-ts-gEq">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
</items>
</menu>
</popUpButtonCell>
<connections>
<binding destination="59d-5C-RD8" name="selectedTag" keyPath="updateCheckInterval" id="SaA-sM-4dT"/>
</connections>
</popUpButton>
</subviews>
<visibilityPriorities>
<integer value="1000"/>
<integer value="1000"/>
</visibilityPriorities>
<customSpacing>
<real value="3.4028234663852886e+38"/>
<real value="3.4028234663852886e+38"/>
</customSpacing>
</stackView>
<stackView distribution="fill" orientation="horizontal" alignment="centerY" horizontalStackHuggingPriority="249.99998474121094" verticalStackHuggingPriority="249.99998474121094" detachesHiddenViews="YES" id="0re-vj-j39">
<rect key="frame" x="32" y="70" width="142" height="21"/>
<rect key="frame" x="32" y="110" width="142" height="21"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<subviews>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="pn9-3U-yqA">
Expand Down Expand Up @@ -119,7 +68,7 @@
</customSpacing>
</stackView>
<stackView distribution="fill" orientation="horizontal" alignment="top" horizontalStackHuggingPriority="249.99998474121094" verticalStackHuggingPriority="249.99998474121094" fixedFrame="YES" detachesHiddenViews="YES" translatesAutoresizingMaskIntoConstraints="NO" id="ZLM-rR-dFA">
<rect key="frame" x="32" y="30" width="194" height="21"/>
<rect key="frame" x="32" y="70" width="194" height="21"/>
<subviews>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Rez-PF-6eu" userLabel="Favorite Hot Key">
<rect key="frame" x="-2" y="5" width="104" height="16"/>
Expand Down Expand Up @@ -149,9 +98,71 @@
<real value="3.4028234663852886e+38"/>
</customSpacing>
</stackView>
<stackView distribution="fill" orientation="horizontal" alignment="centerY" horizontalStackHuggingPriority="249.99998474121094" verticalStackHuggingPriority="249.99998474121094" detachesHiddenViews="YES" id="Jyb-Dr-tW1">
<rect key="frame" x="32" y="31" width="177" height="21"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<subviews>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="LPe-gb-72a" userLabel="Check Update">
<rect key="frame" x="-2" y="3" width="91" height="16"/>
<textFieldCell key="cell" lineBreakMode="clipping" title="Check Update" id="dWG-eZ-o58">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<popUpButton verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="KvF-RK-Ded" userLabel="UpdateInterval">
<rect key="frame" x="93" y="-3" width="87" height="25"/>
<popUpButtonCell key="cell" type="push" title="Hourly" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" tag="3600" imageScaling="proportionallyDown" inset="2" selectedItem="EE6-Ss-Gw7" id="IA7-J9-2tC">
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="menu"/>
<menu key="menu" id="g77-xz-TFH">
<items>
<menuItem title="Hourly" state="on" tag="3600" id="EE6-Ss-Gw7">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
<menuItem title="Daily" tag="86400" id="eEf-BQ-9PH">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
<menuItem title="Weekly" tag="604800" id="fcM-sZ-IDB">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
<menuItem title="Monthly" tag="2629800" id="Lew-rN-naA">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
<menuItem title="Never" id="3TG-ts-gEq">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
</items>
</menu>
</popUpButtonCell>
<connections>
<binding destination="59d-5C-RD8" name="selectedTag" keyPath="updateCheckInterval" id="SaA-sM-4dT"/>
</connections>
</popUpButton>
</subviews>
<visibilityPriorities>
<integer value="1000"/>
<integer value="1000"/>
</visibilityPriorities>
<customSpacing>
<real value="3.4028234663852886e+38"/>
<real value="3.4028234663852886e+38"/>
</customSpacing>
</stackView>
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="UKJ-Sm-MIt">
<rect key="frame" x="30" y="152" width="146" height="18"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="check" title="Popover" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="oJw-7C-ZNt">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<binding destination="xQO-e6-7gF" name="value" keyPath="values.popover" id="r45-V1-XtN"/>
</connections>
</button>
</subviews>
</view>
<point key="canvasLocation" x="19" y="106.5"/>
<point key="canvasLocation" x="22" y="126.5"/>
</window>
<userDefaultsController representsSharedInstance="YES" id="xQO-e6-7gF"/>
<customObject id="59d-5C-RD8" customClass="SUUpdater"/>
Expand Down
2 changes: 1 addition & 1 deletion YPaste/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<key>CFBundleShortVersionString</key>
<string>Explosion v0.1.8</string>
<key>CFBundleVersion</key>
<string>100723</string>
<string>100724</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.utilities</string>
<key>LSMinimumSystemVersion</key>
Expand Down
2 changes: 1 addition & 1 deletion YPaste/Window/TableView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class TableView: NSTableView, NSTableViewDelegate {
@IBOutlet var arrayController: PasteItemsController!

func tableViewSelectionDidChange(_ notification: Notification) {
if self.window == nil { return }
if self.window == nil || !UserDefaults.standard.bool(forKey: "popover") { return }
if let selectedRow = self.rowView(atRow: self.selectedRow, makeIfNecessary: false) {
let selectedPasteItem = (self.arrayController.arrangedObjects as! [PasteItem])[self.selectedRow]
self.popover.updateContent(pasteItem: selectedPasteItem)
Expand Down
3 changes: 3 additions & 0 deletions YPaste/en.lproj/Preferences.strings
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,6 @@

/* Class = "NSTextFieldCell"; title = "Favorite Hot Key"; ObjectID = "Md5-LI-tBD"; */
"Md5-LI-tBD.title" = "";

/* Class = "NSButtonCell"; title = "Popover"; ObjectID = "oJw-7C-ZNt"; */
"oJw-7C-ZNt.title" = "";
9 changes: 6 additions & 3 deletions YPaste/zh-Hans.lproj/Preferences.strings
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
/* Class = "NSTextFieldCell"; title = "Hot Key"; ObjectID = "50p-6v-7SJ"; */
"50p-6v-7SJ.title" = "打开历史";

/* Class = "NSButtonCell"; title = "Button"; ObjectID = "be5-qF-ZfL"; */
"be5-qF-ZfL.title" = "button";

/* Class = "NSTextFieldCell"; title = "Check Update"; ObjectID = "dWG-eZ-o58"; */
"dWG-eZ-o58.title" = "检查更新";

Expand All @@ -29,8 +32,8 @@
/* Class = "NSButtonCell"; title = "Button"; ObjectID = "nxD-fc-hgi"; */
"nxD-fc-hgi.title" = "button";

/* Class = "NSButtonCell"; title = "Popover"; ObjectID = "oJw-7C-ZNt"; */
"oJw-7C-ZNt.title" = "Popover窗口提示";

/* Class = "NSWindow"; title = "Preferences"; ObjectID = "QvC-M9-y7g"; */
"QvC-M9-y7g.title" = "首选项";

/* Class = "NSButtonCell"; title = "Button"; ObjectID = "be5-qF-ZfL"; */
"be5-qF-ZfL.title" = "";

0 comments on commit ff04dfb

Please sign in to comment.