Skip to content

Commit

Permalink
Merged release/1.1.0 into master
Browse files Browse the repository at this point in the history
  • Loading branch information
iain committed Dec 25, 2016
2 parents e92e926 + e9a3ce0 commit 79afac1
Show file tree
Hide file tree
Showing 29 changed files with 470 additions and 166 deletions.
26 changes: 20 additions & 6 deletions FaderBar.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@
/* Begin PBXBuildFile section */
AE21CD121DFF514E0041EDC3 /* PreferencesWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE21CD101DFF514E0041EDC3 /* PreferencesWindow.swift */; };
AE21CD131DFF514E0041EDC3 /* PreferencesWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = AE21CD111DFF514E0041EDC3 /* PreferencesWindow.xib */; };
AE8715B41E0AAC6700F98C06 /* TimeHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE8715B31E0AAC6700F98C06 /* TimeHelper.swift */; };
AE8715B51E0AAC6700F98C06 /* TimeHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE8715B31E0AAC6700F98C06 /* TimeHelper.swift */; };
AE8715B71E0EED9100F98C06 /* VolumeControl.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE8715B61E0EED9100F98C06 /* VolumeControl.swift */; };
AE8715B81E0EED9100F98C06 /* VolumeControl.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE8715B61E0EED9100F98C06 /* VolumeControl.swift */; };
AE8715BA1E0F0AD300F98C06 /* SystemTask.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE8715B91E0F0AD300F98C06 /* SystemTask.swift */; };
AE8715BB1E0F0AD300F98C06 /* SystemTask.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE8715B91E0F0AD300F98C06 /* SystemTask.swift */; };
AE8D0FD71DF600BA00CCC45E /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AE8D0FD61DF600BA00CCC45E /* CoreAudio.framework */; };
AE8D0FDB1DF601EA00CCC45E /* ISSoundAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = AE8D0FDA1DF601EA00CCC45E /* ISSoundAdditions.m */; };
AEAE7E3E1DF33A5900B0774E /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = AEAE7E3D1DF33A5900B0774E /* AppDelegate.swift */; };
Expand All @@ -17,8 +23,6 @@
AEAE7E4E1DF33A5900B0774E /* FaderBarTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = AEAE7E4D1DF33A5900B0774E /* FaderBarTests.swift */; };
AEAE7E591DF33A5900B0774E /* FaderBarUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = AEAE7E581DF33A5900B0774E /* FaderBarUITests.swift */; };
AEAE7E671DF42BCB00B0774E /* StatusMenuController.swift in Sources */ = {isa = PBXBuildFile; fileRef = AEAE7E661DF42BCB00B0774E /* StatusMenuController.swift */; };
AEAE7E6B1DF432E800B0774E /* VolumeControl.swift in Sources */ = {isa = PBXBuildFile; fileRef = AEAE7E6A1DF432E800B0774E /* VolumeControl.swift */; };
AEAE7E6C1DF432E800B0774E /* VolumeControl.swift in Sources */ = {isa = PBXBuildFile; fileRef = AEAE7E6A1DF432E800B0774E /* VolumeControl.swift */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
Expand All @@ -41,6 +45,9 @@
/* Begin PBXFileReference section */
AE21CD101DFF514E0041EDC3 /* PreferencesWindow.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PreferencesWindow.swift; sourceTree = "<group>"; };
AE21CD111DFF514E0041EDC3 /* PreferencesWindow.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = PreferencesWindow.xib; sourceTree = "<group>"; };
AE8715B31E0AAC6700F98C06 /* TimeHelper.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TimeHelper.swift; sourceTree = "<group>"; };
AE8715B61E0EED9100F98C06 /* VolumeControl.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = VolumeControl.swift; sourceTree = "<group>"; };
AE8715B91E0F0AD300F98C06 /* SystemTask.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SystemTask.swift; sourceTree = "<group>"; };
AE8D0FD61DF600BA00CCC45E /* CoreAudio.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreAudio.framework; path = System/Library/Frameworks/CoreAudio.framework; sourceTree = SDKROOT; };
AE8D0FD81DF601E900CCC45E /* FaderBar-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "FaderBar-Bridging-Header.h"; sourceTree = "<group>"; };
AE8D0FD91DF601EA00CCC45E /* ISSoundAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ISSoundAdditions.h; path = "../../../Downloads/ISSoundAdditions-master/ISSoundAdditions.h"; sourceTree = "<group>"; };
Expand All @@ -57,7 +64,6 @@
AEAE7E581DF33A5900B0774E /* FaderBarUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FaderBarUITests.swift; sourceTree = "<group>"; };
AEAE7E5A1DF33A5900B0774E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
AEAE7E661DF42BCB00B0774E /* StatusMenuController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StatusMenuController.swift; sourceTree = "<group>"; };
AEAE7E6A1DF432E800B0774E /* VolumeControl.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = VolumeControl.swift; path = ../VolumeControl.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -118,7 +124,7 @@
AEAE7E3C1DF33A5900B0774E /* FaderBar */ = {
isa = PBXGroup;
children = (
AEAE7E6A1DF432E800B0774E /* VolumeControl.swift */,
AE8715B61E0EED9100F98C06 /* VolumeControl.swift */,
AE8D0FD91DF601EA00CCC45E /* ISSoundAdditions.h */,
AE8D0FDA1DF601EA00CCC45E /* ISSoundAdditions.m */,
AEAE7E3D1DF33A5900B0774E /* AppDelegate.swift */,
Expand All @@ -129,6 +135,8 @@
AEAE7E441DF33A5900B0774E /* Info.plist */,
AEAE7E661DF42BCB00B0774E /* StatusMenuController.swift */,
AE8D0FD81DF601E900CCC45E /* FaderBar-Bridging-Header.h */,
AE8715B31E0AAC6700F98C06 /* TimeHelper.swift */,
AE8715B91E0F0AD300F98C06 /* SystemTask.swift */,
);
path = FaderBar;
sourceTree = "<group>";
Expand Down Expand Up @@ -288,9 +296,11 @@
files = (
AEAE7E671DF42BCB00B0774E /* StatusMenuController.swift in Sources */,
AE21CD121DFF514E0041EDC3 /* PreferencesWindow.swift in Sources */,
AE8715B41E0AAC6700F98C06 /* TimeHelper.swift in Sources */,
AE8715BA1E0F0AD300F98C06 /* SystemTask.swift in Sources */,
AE8D0FDB1DF601EA00CCC45E /* ISSoundAdditions.m in Sources */,
AEAE7E3E1DF33A5900B0774E /* AppDelegate.swift in Sources */,
AEAE7E6B1DF432E800B0774E /* VolumeControl.swift in Sources */,
AE8715B71E0EED9100F98C06 /* VolumeControl.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand All @@ -299,7 +309,9 @@
buildActionMask = 2147483647;
files = (
AEAE7E4E1DF33A5900B0774E /* FaderBarTests.swift in Sources */,
AEAE7E6C1DF432E800B0774E /* VolumeControl.swift in Sources */,
AE8715B51E0AAC6700F98C06 /* TimeHelper.swift in Sources */,
AE8715B81E0EED9100F98C06 /* VolumeControl.swift in Sources */,
AE8715BB1E0F0AD300F98C06 /* SystemTask.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -469,6 +481,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = iain8.FaderBarTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "FaderBar/FaderBar-Bridging-Header.h";
SWIFT_VERSION = 3.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/FaderBar.app/Contents/MacOS/FaderBar";
};
Expand All @@ -484,6 +497,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = iain8.FaderBarTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "FaderBar/FaderBar-Bridging-Header.h";
SWIFT_VERSION = 3.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/FaderBar.app/Contents/MacOS/FaderBar";
};
Expand Down
1 change: 0 additions & 1 deletion FaderBar/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,3 @@ class AppDelegate: NSObject, NSApplicationDelegate {
func applicationWillTerminate(_ aNotification: Notification) {
}
}

30 changes: 20 additions & 10 deletions FaderBar/Assets.xcassets/AppIcon.appiconset/Contents.json
Original file line number Diff line number Diff line change
@@ -1,53 +1,63 @@
{
"images" : [
{
"idiom" : "mac",
"size" : "16x16",
"idiom" : "mac",
"filename" : "pug16.png",
"scale" : "1x"
},
{
"idiom" : "mac",
"size" : "16x16",
"idiom" : "mac",
"filename" : "pug32-1.png",
"scale" : "2x"
},
{
"idiom" : "mac",
"size" : "32x32",
"idiom" : "mac",
"filename" : "pug32.png",
"scale" : "1x"
},
{
"idiom" : "mac",
"size" : "32x32",
"idiom" : "mac",
"filename" : "pug64.png",
"scale" : "2x"
},
{
"idiom" : "mac",
"size" : "128x128",
"idiom" : "mac",
"filename" : "pug128.png",
"scale" : "1x"
},
{
"idiom" : "mac",
"size" : "128x128",
"idiom" : "mac",
"filename" : "pug256-1.png",
"scale" : "2x"
},
{
"idiom" : "mac",
"size" : "256x256",
"idiom" : "mac",
"filename" : "pug256.png",
"scale" : "1x"
},
{
"idiom" : "mac",
"size" : "256x256",
"idiom" : "mac",
"filename" : "ItunesArtwork-1.png",
"scale" : "2x"
},
{
"idiom" : "mac",
"size" : "512x512",
"idiom" : "mac",
"filename" : "ItunesArtwork.png",
"scale" : "1x"
},
{
"idiom" : "mac",
"size" : "512x512",
"idiom" : "mac",
"filename" : "ItunesArtwork@2x.png",
"scale" : "2x"
}
],
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions FaderBar/Assets.xcassets/bwStatusIcon.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "pug-bw.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "pug-bw2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "pug-bw3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 5 additions & 1 deletion FaderBar/Base.lproj/MainMenu.xib
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,14 @@
<connections>
<outlet property="actionButton" destination="rBD-QR-Km0" id="KnQ-y9-i1B"/>
<outlet property="statusMenu" destination="6Jm-BO-0dg" id="BVd-FJ-5z8"/>
<outlet property="timeIndicator" destination="9uM-MA-mKj" id="UJt-vv-9Nd"/>
</connections>
</customObject>
<menu id="6Jm-BO-0dg">
<items>
<menuItem title="Fade time: 30m" enabled="NO" id="9uM-MA-mKj">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
<menuItem title="Start" id="rBD-QR-Km0">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
Expand All @@ -43,7 +47,7 @@
</connections>
</menuItem>
</items>
<point key="canvasLocation" x="3974.5" y="46.5"/>
<point key="canvasLocation" x="3974" y="36.5"/>
</menu>
</objects>
</document>
2 changes: 1 addition & 1 deletion FaderBar/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<string>1.1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSMinimumSystemVersion</key>
Expand Down
73 changes: 60 additions & 13 deletions FaderBar/PreferencesWindow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// Created by iain on 12/12/16.
// Copyright © 2016 iain. All rights reserved.
//
protocol PreferencesWindowDelegate {
protocol PreferencesWindowDelegate: class {
func preferencesDidUpdate()
}

Expand All @@ -15,30 +15,69 @@ import Cocoa
class PreferencesWindow: NSWindowController, NSWindowDelegate {
/// The fade out time field
@IBOutlet weak var fadeTimeField: NSTextField!


/// The fade out time slider
@IBOutlet weak var fadeTimeSlider: NSSlider!

/// Checkbox for post-fade sleep
@IBOutlet weak var sleepCheckbox: NSButton!

/// Window delegate
var delegate: PreferencesWindowDelegate?
weak var delegate: PreferencesWindowDelegate?

/// Name of window
override var windowNibName: String! {
return "PreferencesWindow"
}


/// Time intervals for selector
let timeIntervals: [Double] = [5.0, 10.0, 15.0, 30.0, 60.0, 120.0, 240.0, 360.0]

/**
Populate preferences fields when window is opened
*/
override func windowDidLoad() {
super.windowDidLoad()

self.window?.center()
self.window?.makeKeyAndOrderFront(nil)
NSApp.activate(ignoringOtherApps: true)

fadeTimeField.stringValue = UserDefaults.standard.string(forKey: "fadeTime") ?? String(DEFAULT_FADELENGTH / 60.0)

fadeTimeField.doubleValue = UserDefaults.standard.double(forKey: "fadeTime")
}

func windowDidBecomeMain(_ notification: Notification) {
if UserDefaults.standard.bool(forKey: "prefsDisabled") {
self.fadeTimeField.isEnabled = false
self.fadeTimeSlider.isEnabled = false
} else {
self.fadeTimeField.isEnabled = true
self.fadeTimeSlider.isEnabled = true
}
}


/**
Fade time slider action
*/
@IBAction func fadeTimeChanged(_ sender: Any) {
fadeTimeField.doubleValue = timeIntervals[fadeTimeSlider.integerValue]
}

/**
"Done" button action
*/
@IBAction func saveButtonClicked(_ sender: Any) {
self.updatePreferences()

self.window?.close()
}

/**
On close preferences, update fade time
Expand All @@ -47,10 +86,18 @@ class PreferencesWindow: NSWindowController, NSWindowDelegate {
*/
func windowWillClose(_ notification: Notification) {
let defaults = UserDefaults.standard

defaults.setValue(fadeTimeField.stringValue, forKey: "fadeTime")

self.updatePreferences()
}

/**
Update preferences
*/
func updatePreferences() {
UserDefaults.standard.setValue(self.fadeTimeField.doubleValue, forKey: "fadeTime")
UserDefaults.standard.setValue(self.sleepCheckbox.state, forKey: "sleepAfterwards")

delegate?.preferencesDidUpdate()
}
}
Loading

0 comments on commit 79afac1

Please sign in to comment.