Skip to content

Commit

Permalink
修复了设置中开机启动 Checkbox 状态无法保存的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
Caldis committed Mar 29, 2017
1 parent 760e3b2 commit 3d79982
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 7 deletions.
14 changes: 12 additions & 2 deletions Mos/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="11762"/>
<capability name="box content view" minToolsVersion="7.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
<capability name="stacking Non-gravity area distributions on NSStackView" minToolsVersion="7.0" minSystemVersion="10.11"/>
<capability name="system font weights other than Regular or Bold" minToolsVersion="7.0"/>
Expand Down Expand Up @@ -701,7 +702,7 @@
</subviews>
</visualEffectView>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" allowsCharacterPickerTouchBarItem="NO" translatesAutoresizingMaskIntoConstraints="NO" id="S8y-Am-MEW">
<rect key="frame" x="18" y="53" width="137" height="73"/>
<rect key="frame" x="18" y="56" width="137" height="73"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="left" title="Mos" id="2AK-Pu-mot">
<font key="font" metaFont="systemThin" size="70"/>
Expand All @@ -710,14 +711,23 @@
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" allowsCharacterPickerTouchBarItem="NO" translatesAutoresizingMaskIntoConstraints="NO" id="uMH-2l-9yi">
<rect key="frame" x="159" y="57" width="273" height="18"/>
<rect key="frame" x="151" y="59" width="273" height="18"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="left" title="Just some little job for mouse." id="5cx-xS-eRe">
<font key="font" metaFont="systemLight" size="11"/>
<color key="textColor" red="0.40000000000000002" green="0.40000000000000002" blue="0.40000000000000002" alpha="0.84999999999999998" colorSpace="calibratedRGB"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<box fixedFrame="YES" boxType="custom" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="4J9-Gb-tD6">
<rect key="frame" x="0.0" y="60" width="27" height="3"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<view key="contentView" ambiguous="YES" id="hdK-Xi-GFx">
<rect key="frame" x="1" y="1" width="25" height="1"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
</view>
<color key="fillColor" red="0.14116021989999999" green="0.14118680359999999" blue="0.14115440849999999" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</box>
</subviews>
</view>
<connections>
Expand Down
4 changes: 2 additions & 2 deletions Mos/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.5.0</string>
<string>1.5.1</string>
<key>CFBundleVersion</key>
<string>20170324</string>
<string>20170329</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.utilities</string>
<key>LSMinimumSystemVersion</key>
Expand Down
2 changes: 0 additions & 2 deletions Mos/PreferencesGeneralViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ class PreferencesGeneralViewController: NSViewController {
// 保存设置
UserDefaults.standard.set(ScrollCore.option.reverse ? "true" : "false", forKey:"reverse")
}

// 是否开机启动
@IBAction func launchOnLoginClick(_ sender: NSButton) {
if sender.state == 0 {
Expand All @@ -54,7 +53,6 @@ class PreferencesGeneralViewController: NSViewController {
ScrollCore.option.autoLaunch = true
LaunchStarter.enableLaunchAtStartup()
}

// 保存设置
UserDefaults.standard.set(ScrollCore.option.autoLaunch ? "true" : "false", forKey:"autoLaunch")
}
Expand Down
3 changes: 2 additions & 1 deletion Mos/PreferencesUpdatesViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class PreferencesUpdatesViewController: NSViewController {

// 国际化相关
let CurrentVersionLabelTitle = NSLocalizedString("Current Version", comment: "")

// 版本号
@IBOutlet weak var versionLabel: NSTextField!

override func viewDidLoad() {
Expand All @@ -22,6 +22,7 @@ class PreferencesUpdatesViewController: NSViewController {
versionLabel.stringValue = "\(CurrentVersionLabelTitle) : \(version as! String)"
}

// 点击查询更新按钮
@IBAction func checkButtonClick(_ sender: NSButton) {
NSWorkspace.shared().open(URL(string: "https://github.com/Caldis/Mos/releases/")!)
}
Expand Down
3 changes: 3 additions & 0 deletions Mos/ScrollCore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,9 @@ class ScrollCore: NSObject {
if let reverse = UserDefaults.standard.string(forKey: "reverse") {
ScrollCore.option.reverse = reverse=="true" ? true : false
}
if let autoLaunch = UserDefaults.standard.string(forKey: "autoLaunch") {
ScrollCore.option.autoLaunch = autoLaunch=="true" ? true : false
}
if UserDefaults.standard.double(forKey: "speed") != 0.0 {
ScrollCore.advancedOption.speed = UserDefaults.standard.double(forKey: "speed")
}
Expand Down

0 comments on commit 3d79982

Please sign in to comment.