Skip to content

Commit

Permalink
Reversed Blacklist/Whitelist naming, Prefs Window
Browse files Browse the repository at this point in the history
- Blacklist is now the default setting and will exclude apps
- Whitelist will now block non-listed apps
- There is now a shared preferences window controller accessible through the AppDelegate (previously a new controller was created each time the window was opened but never released)
- The ExcludeViewController now uses an NSPopUpButton for the list preference instead of an NSSegmentedControl
- The third menu item is now labeled "Preferences…" and allows the default preferences shortcut
- Added "Close" menu item to menubar so that cmd+w works with the preferences window
  • Loading branch information
floschliep committed May 25, 2016
1 parent dfd983a commit 3d55831
Show file tree
Hide file tree
Showing 26 changed files with 86 additions and 81 deletions.
Empty file modified Assets/q-blocker-icon.sketch
100644 → 100755
Empty file.
Empty file modified Assets/qblocker-icons/1024.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified Assets/qblocker-icons/128.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified Assets/qblocker-icons/16.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified Assets/qblocker-icons/256.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified Assets/qblocker-icons/32.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified Assets/qblocker-icons/512.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified Assets/qblocker-icons/64.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified Assets/qblocker-icons/github.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified Podfile
100644 → 100755
Empty file.
Empty file modified Podfile.lock
100644 → 100755
Empty file.
4 changes: 4 additions & 0 deletions QBlocker.xcodeproj/project.pbxproj
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
objects = {

/* Begin PBXBuildFile section */
13FA35AC1CF623C400A29767 /* ListMode.swift in Sources */ = {isa = PBXBuildFile; fileRef = 13FA35AB1CF623C400A29767 /* ListMode.swift */; };
280140151CDA9D5200BC2E78 /* AtLogin.swift in Sources */ = {isa = PBXBuildFile; fileRef = 280140141CDA9D5200BC2E78 /* AtLogin.swift */; };
2832CA361CD688E9001D3373 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2832CA351CD688E9001D3373 /* AppDelegate.swift */; };
2832CA3A1CD688E9001D3373 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 2832CA391CD688E9001D3373 /* Assets.xcassets */; };
Expand All @@ -31,6 +32,7 @@
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
13FA35AB1CF623C400A29767 /* ListMode.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListMode.swift; sourceTree = "<group>"; };
18D302062F0781EB95263F14 /* Pods-QBlocker.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-QBlocker.release.xcconfig"; path = "Pods/Target Support Files/Pods-QBlocker/Pods-QBlocker.release.xcconfig"; sourceTree = "<group>"; };
280140141CDA9D5200BC2E78 /* AtLogin.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AtLogin.swift; sourceTree = "<group>"; };
2832CA321CD688E9001D3373 /* QBlocker.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = QBlocker.app; sourceTree = BUILT_PRODUCTS_DIR; };
Expand Down Expand Up @@ -154,6 +156,7 @@
28A518661CDE997400BE7ED1 /* ExcludeViewController + NSTableViewDelegate.swift */,
28A5185A1CDE416800BE7ED1 /* ExcludeWindowController.swift */,
28A5185E1CDE87A300BE7ED1 /* App.swift */,
13FA35AB1CF623C400A29767 /* ListMode.swift */,
);
name = "Exclude Apps";
sourceTree = "<group>";
Expand Down Expand Up @@ -303,6 +306,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
13FA35AC1CF623C400A29767 /* ListMode.swift in Sources */,
28DEC8061CD954EA0012B5E3 /* HUDView.swift in Sources */,
28A518631CDE91C200BE7ED1 /* ExcludeViewController + NSTableViewDataSource.swift in Sources */,
2853B63B1CD92D9700F186CE /* StatusMenuController.swift in Sources */,
Expand Down
Empty file modified QBlocker.xcodeproj/project.xcworkspace/contents.xcworkspacedata
100644 → 100755
Empty file.
Empty file modified QBlocker.xcworkspace/contents.xcworkspacedata
100644 → 100755
Empty file.
25 changes: 23 additions & 2 deletions QBlocker/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,25 @@ import Cocoa
@NSApplicationMain
class AppDelegate: NSObject, NSApplicationDelegate {

var accessibilityWindowController: NSWindowController?
var firstRunWindowController: NSWindowController?
private var accessibilityWindowController: NSWindowController?
private var firstRunWindowController: NSWindowController?
private lazy var preferencesWindowController: NSWindowController = {
return NSStoryboard(name: "Main", bundle: nil).instantiateControllerWithIdentifier("preferences window") as! NSWindowController
}()

class var sharedDelegate: AppDelegate? {
return NSApplication.sharedApplication().delegate as? AppDelegate
}

// MARK: - Instantiation

override init() {
super.init()
NSUserDefaults.standardUserDefaults().registerDefaults(["accidentalQuits": 0, "firstRunComplete": false, "listMode": 0])
}

// MARK: - NSApplicationDelegate

func applicationDidFinishLaunching(aNotification: NSNotification) {

setupDevMate()
Expand All @@ -44,6 +55,8 @@ class AppDelegate: NSObject, NSApplicationDelegate {

}

// MARK: - Actions

/**
Show the first run screen if the NSUserDefault stating it has already be run isn't set
*/
Expand All @@ -60,6 +73,14 @@ class AppDelegate: NSObject, NSApplicationDelegate {
NSUserDefaults.standardUserDefaults().setBool(true, forKey: "firstRunComplete")
}
}

/**
Bring the app into foreground and show the preferences window
*/
func showPreferencesWindow() {
NSApplication.sharedApplication().activateIgnoringOtherApps(true)
self.preferencesWindowController.showWindow(nil)
}

/**
Setup the devmate tracker, issues and updater
Expand Down
77 changes: 33 additions & 44 deletions QBlocker/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@
<action selector="performMiniaturize:" target="Ady-hI-5gd" id="VwT-WD-YPe"/>
</connections>
</menuItem>
<menuItem title="Close" keyEquivalent="w" id="C14-wL-mfK">
<connections>
<action selector="orderOut:" target="Ady-hI-5gd" id="or3-oz-1nw"/>
</connections>
</menuItem>
<menuItem title="Zoom" id="R4o-n2-Eq4">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
Expand Down Expand Up @@ -83,10 +88,9 @@
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
<menuItem isSeparatorItem="YES" id="Rxk-WH-Wkd"/>
<menuItem title="Exclude Apps" id="zj1-g2-cGs">
<modifierMask key="keyEquivalentModifierMask"/>
<menuItem title="Preferences…" keyEquivalent="," id="zj1-g2-cGs">
<connections>
<segue destination="jz5-Br-QOJ" kind="show" id="xhC-FZ-oih"/>
<action selector="showPreferences:" target="urJ-qt-1M5" id="eHd-rz-tBh"/>
</connections>
</menuItem>
<menuItem title="Check For Updates" id="77f-nv-QKY">
Expand Down Expand Up @@ -241,7 +245,7 @@
<!--Window Controller-->
<scene sceneID="6aa-xv-SIJ">
<objects>
<windowController showSeguePresentationStyle="single" id="gfC-8x-n2e" sceneMemberID="viewController">
<windowController storyboardIdentifier="preferences window" showSeguePresentationStyle="single" id="gfC-8x-n2e" sceneMemberID="viewController">
<window key="window" identifier="exclude apps window" title="Exclude Apps" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" oneShot="NO" releasedWhenClosed="NO" showsToolbarButton="NO" visibleAtLaunch="NO" frameAutosaveName="" animationBehavior="default" id="HV7-1Y-AXw">
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES" unifiedTitleAndToolbar="YES"/>
<rect key="contentRect" x="196" y="240" width="480" height="270"/>
Expand All @@ -264,13 +268,13 @@
<autoresizingMask key="autoresizingMask"/>
<subviews>
<scrollView autohidesScrollers="YES" horizontalLineScroll="19" horizontalPageScroll="10" verticalLineScroll="19" verticalPageScroll="10" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="zh1-4Z-4tW">
<rect key="frame" x="20" y="59" width="440" height="149"/>
<rect key="frame" x="20" y="59" width="440" height="174"/>
<clipView key="contentView" id="28T-TC-E8L">
<rect key="frame" x="1" y="1" width="438" height="147"/>
<rect key="frame" x="1" y="1" width="438" height="172"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" alternatingRowBackgroundColors="YES" columnReordering="NO" autosaveColumns="NO" typeSelect="NO" rowSizeStyle="automatic" viewBased="YES" id="SWt-Cl-IuJ">
<rect key="frame" x="0.0" y="0.0" width="438" height="147"/>
<rect key="frame" x="0.0" y="0.0" width="438" height="172"/>
<autoresizingMask key="autoresizingMask"/>
<size key="intercellSpacing" width="3" height="2"/>
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
Expand Down Expand Up @@ -359,64 +363,55 @@
</connections>
</button>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="200-4c-TLg">
<rect key="frame" x="18" y="227" width="444" height="17"/>
<textFieldCell key="cell" sendsActionOnEndEditing="YES" title="QBlocker will ignore these apps when using ⌘Q:" id="tTH-fJ-Voj">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="esb-KC-nLb">
<rect key="frame" x="18" y="254" width="46" height="17"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Act as:" id="qUj-ZI-GUW">
<rect key="frame" x="116" y="254" width="346" height="17"/>
<textFieldCell key="cell" sendsActionOnEndEditing="YES" title="QBlocker on the following apps:" id="tTH-fJ-Voj">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<segmentedControl verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="UUB-aA-zGd">
<rect key="frame" x="68" y="250" width="151" height="24"/>
<segmentedCell key="cell" borderStyle="border" alignment="left" style="rounded" trackingMode="selectOne" id="H3f-t1-WjD">
<font key="font" metaFont="system"/>
<segments>
<segment label="Whitelist" selected="YES"/>
<segment label="Blacklist" tag="1"/>
</segments>
</segmentedCell>
<popUpButton horizontalHuggingPriority="1000" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Ija-R0-jFa">
<rect key="frame" x="18" y="249" width="95" height="26"/>
<popUpButtonCell key="cell" type="push" title="Don't use" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" selectedItem="29s-ie-PBn" id="tax-Yo-Qah">
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="menu"/>
<menu key="menu" id="3yo-cB-cHo">
<items>
<menuItem title="Don't use" state="on" id="29s-ie-PBn"/>
<menuItem title="Use" id="HAv-aU-ig3"/>
</items>
</menu>
</popUpButtonCell>
<connections>
<action selector="modeChanged:" target="jz5-Br-QOJ" id="68g-Pi-wvm"/>
<binding destination="FMf-NB-J6F" name="selectedIndex" keyPath="values.listMode" id="Efw-Sr-EFg"/>
<binding destination="FMf-NB-J6F" name="selectedIndex" keyPath="values.listMode" id="Yf4-KB-Y8R"/>
</connections>
</segmentedControl>
</popUpButton>
</subviews>
<constraints>
<constraint firstAttribute="trailing" secondItem="zh1-4Z-4tW" secondAttribute="trailing" constant="20" id="5nG-3o-8sd"/>
<constraint firstItem="UUB-aA-zGd" firstAttribute="leading" secondItem="esb-KC-nLb" secondAttribute="trailing" constant="8" id="6AR-Sa-EE9"/>
<constraint firstItem="Ija-R0-jFa" firstAttribute="top" secondItem="awZ-l5-lQX" secondAttribute="top" constant="25" id="EIy-mm-Zeh"/>
<constraint firstAttribute="bottom" secondItem="aRi-02-kha" secondAttribute="bottom" constant="20" id="Faf-ZU-ZLx"/>
<constraint firstItem="zh1-4Z-4tW" firstAttribute="top" secondItem="200-4c-TLg" secondAttribute="bottom" constant="19" id="G7G-9n-T4K"/>
<constraint firstAttribute="trailing" secondItem="200-4c-TLg" secondAttribute="trailing" constant="20" id="Geg-OC-6ac"/>
<constraint firstItem="UUB-aA-zGd" firstAttribute="top" secondItem="awZ-l5-lQX" secondAttribute="top" constant="25" id="OVT-fe-Mhk"/>
<constraint firstItem="zh1-4Z-4tW" firstAttribute="top" secondItem="Ija-R0-jFa" secondAttribute="bottom" constant="19" id="Gpo-Yb-iiP"/>
<constraint firstItem="Ija-R0-jFa" firstAttribute="leading" secondItem="awZ-l5-lQX" secondAttribute="leading" constant="20" id="S5M-ia-niO"/>
<constraint firstItem="915-3U-2Q2" firstAttribute="leading" secondItem="awZ-l5-lQX" secondAttribute="leading" constant="20" id="T4l-cg-scf"/>
<constraint firstItem="aRi-02-kha" firstAttribute="top" secondItem="zh1-4Z-4tW" secondAttribute="bottom" constant="16" id="YIe-2p-gXb"/>
<constraint firstItem="esb-KC-nLb" firstAttribute="leading" secondItem="awZ-l5-lQX" secondAttribute="leading" constant="20" id="eWJ-CQ-az9"/>
<constraint firstItem="200-4c-TLg" firstAttribute="top" secondItem="UUB-aA-zGd" secondAttribute="bottom" constant="8" id="fq4-vd-GH9"/>
<constraint firstItem="aRi-02-kha" firstAttribute="leading" secondItem="awZ-l5-lQX" secondAttribute="leading" constant="44" id="hXm-wy-iSY"/>
<constraint firstItem="915-3U-2Q2" firstAttribute="top" secondItem="zh1-4Z-4tW" secondAttribute="bottom" constant="16" id="ilj-L3-Tsh"/>
<constraint firstItem="UUB-aA-zGd" firstAttribute="centerY" secondItem="esb-KC-nLb" secondAttribute="centerY" id="p91-fi-Ka0"/>
<constraint firstItem="200-4c-TLg" firstAttribute="leading" secondItem="Ija-R0-jFa" secondAttribute="trailing" constant="8" id="iu9-FB-qOq"/>
<constraint firstAttribute="bottom" secondItem="915-3U-2Q2" secondAttribute="bottom" constant="20" id="snG-o3-20c"/>
<constraint firstItem="200-4c-TLg" firstAttribute="centerY" secondItem="Ija-R0-jFa" secondAttribute="centerY" id="vbF-2b-twB"/>
<constraint firstItem="zh1-4Z-4tW" firstAttribute="leading" secondItem="awZ-l5-lQX" secondAttribute="leading" constant="20" id="zMN-jJ-NOu"/>
<constraint firstItem="200-4c-TLg" firstAttribute="leading" secondItem="awZ-l5-lQX" secondAttribute="leading" constant="20" id="zMZ-Wg-VzA"/>
</constraints>
</view>
<connections>
<outlet property="modeDescriptionLabel" destination="200-4c-TLg" id="CRv-bX-L9J"/>
<outlet property="tableView" destination="SWt-Cl-IuJ" id="A8n-9v-86d"/>
</connections>
</viewController>
<customObject id="ugb-oY-o80" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
<userDefaultsController representsSharedInstance="YES" id="FMf-NB-J6F"/>
</objects>
<point key="canvasLocation" x="1501" y="147.5"/>
<point key="canvasLocation" x="1501" y="147"/>
</scene>
<!--Window Controller-->
<scene sceneID="elp-cf-pyV">
Expand Down Expand Up @@ -522,9 +517,6 @@
<constraint firstItem="NZ2-Gz-crp" firstAttribute="top" secondItem="ESu-Xb-exo" secondAttribute="bottom" constant="31" id="yZb-u4-M60"/>
</constraints>
</view>
<connections>
<segue destination="jz5-Br-QOJ" kind="show" identifier="show exclude apps" id="iNS-YF-V7y"/>
</connections>
</viewController>
<customObject id="edL-yY-2fy" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
</objects>
Expand All @@ -537,7 +529,4 @@
<image name="Tick" width="516" height="516"/>
<image name="settings" width="516" height="516"/>
</resources>
<inferredMetricsTieBreakers>
<segue reference="xhC-FZ-oih"/>
</inferredMetricsTieBreakers>
</document>
19 changes: 0 additions & 19 deletions QBlocker/ExcludeViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@ import RealmSwift
class ExcludeViewController: NSViewController {

@IBOutlet weak var tableView: NSTableView!
@IBOutlet weak var modeDescriptionLabel: NSTextField! {
didSet {
self.updateModeDescriptionLabel()
}
}

// MARK: - Actions

Expand Down Expand Up @@ -66,18 +61,4 @@ class ExcludeViewController: NSViewController {
tableView.reloadData()
}

@IBAction func modeChanged(sender: NSSegmentedControl) {
self.updateModeDescriptionLabel()
}

// MARK: - Helpers

private func updateModeDescriptionLabel() {
if ListMode.selectedMode == .Whitelist {
self.modeDescriptionLabel.stringValue = "QBlocker will ignore these apps when using ⌘Q:"
} else {
self.modeDescriptionLabel.stringValue = "QBlocker will only block these apps when using ⌘Q:"
}
}

}
2 changes: 1 addition & 1 deletion QBlocker/FirstRunViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class FirstRunViewController: NSViewController {
}

@IBAction func showExcludeApps(sender: AnyObject) {
performSegueWithIdentifier("show exclude apps", sender: sender)
AppDelegate.sharedDelegate?.showPreferencesWindow()
view.window?.orderOut(self)
}

Expand Down
2 changes: 1 addition & 1 deletion QBlocker/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>17</string>
<string>18</string>
<key>LSMinimumSystemVersion</key>
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
<key>LSUIElement</key>
Expand Down
Loading

0 comments on commit 3d55831

Please sign in to comment.