Skip to content

Commit

Permalink
Improved language for context menu checkbox description.
Browse files Browse the repository at this point in the history
Disable sandbox.
Prompt to move to Applications directory on open.
Reduce size of icon.
Prompt to enable extension.
Add help button that prompts to enable extension.
  • Loading branch information
terry-au committed Apr 9, 2019
1 parent 691b4c8 commit 32f69b0
Show file tree
Hide file tree
Showing 10 changed files with 145 additions and 69 deletions.
17 changes: 17 additions & 0 deletions QuickTerm.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
3346B9D0211E57B400685BF8 /* Settings.mm in Sources */ = {isa = PBXBuildFile; fileRef = D5AF6D9E6E25808D98B23C6C /* Settings.mm */; };
3346B9D2211E588500685BF8 /* TerminalService.m in Sources */ = {isa = PBXBuildFile; fileRef = D5AF67CA20824F44CEF39C8B /* TerminalService.m */; };
336B7D74211E6D02008BE50C /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 3346BA06211E6C0A00685BF8 /* Assets.xcassets */; };
336BD3FE225C652E0000C361 /* PFMoveApplication.m in Sources */ = {isa = PBXBuildFile; fileRef = 336BD3FC225C652E0000C361 /* PFMoveApplication.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
336D0368211FE26D003862A7 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 336D0367211FE26D003862A7 /* Main.storyboard */; };
336D036B211FE2DE003862A7 /* SettingsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 336D036A211FE2DE003862A7 /* SettingsViewController.m */; };
33AAD19C20F37D36005E9F88 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 33AAD19B20F37D36005E9F88 /* AppDelegate.m */; };
Expand Down Expand Up @@ -55,6 +56,8 @@
3346BA06211E6C0A00685BF8 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
335E9434211E395800F8A807 /* TerminalServiceRegistry.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TerminalServiceRegistry.h; sourceTree = "<group>"; };
335E9435211E395800F8A807 /* TerminalServiceRegistry.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = TerminalServiceRegistry.m; sourceTree = "<group>"; };
336BD3FC225C652E0000C361 /* PFMoveApplication.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PFMoveApplication.m; sourceTree = "<group>"; };
336BD3FD225C652E0000C361 /* PFMoveApplication.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PFMoveApplication.h; sourceTree = "<group>"; };
336D0367211FE26D003862A7 /* Main.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = Main.storyboard; sourceTree = "<group>"; };
336D0369211FE2DE003862A7 /* SettingsViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SettingsViewController.h; sourceTree = "<group>"; };
336D036A211FE2DE003862A7 /* SettingsViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SettingsViewController.m; sourceTree = "<group>"; };
Expand Down Expand Up @@ -114,6 +117,15 @@
path = "Shared Classes";
sourceTree = "<group>";
};
336BD3FB225C650D0000C361 /* Third Party */ = {
isa = PBXGroup;
children = (
336BD3FD225C652E0000C361 /* PFMoveApplication.h */,
336BD3FC225C652E0000C361 /* PFMoveApplication.m */,
);
path = "Third Party";
sourceTree = "<group>";
};
33AAD18E20F37D36005E9F88 = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -141,6 +153,7 @@
33AAD19D20F37D37005E9F88 /* Assets.xcassets */,
336D0367211FE26D003862A7 /* Main.storyboard */,
336D0369211FE2DE003862A7 /* SettingsViewController.h */,
336BD3FB225C650D0000C361 /* Third Party */,
336D036A211FE2DE003862A7 /* SettingsViewController.m */,
33AAD1A220F37D37005E9F88 /* Info.plist */,
33AAD1A320F37D37005E9F88 /* main.m */,
Expand Down Expand Up @@ -211,6 +224,9 @@
com.apple.ApplicationGroups.Mac = {
enabled = 1;
};
com.apple.Sandbox = {
enabled = 0;
};
};
};
};
Expand Down Expand Up @@ -275,6 +291,7 @@
336D036B211FE2DE003862A7 /* SettingsViewController.m in Sources */,
33AAD19C20F37D36005E9F88 /* AppDelegate.m in Sources */,
D5AF64B4E2B45BFEE21410FF /* Settings.mm in Sources */,
336BD3FE225C652E0000C361 /* PFMoveApplication.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
6 changes: 6 additions & 0 deletions QuickTerm/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,20 @@
//

#import "AppDelegate.h"
#import "Third Party/PFMoveApplication.h"

@interface AppDelegate ()

@end

@implementation AppDelegate

- (void)applicationWillFinishLaunching:(NSNotification *)notification {
PFMoveToApplicationsFolderIfNecessary();
}

- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {

}

- (void)applicationWillTerminate:(NSNotification *)aNotification {
Expand Down
50 changes: 32 additions & 18 deletions QuickTerm/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="14113" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" initialViewController="RXu-r0-QSh">
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" initialViewController="RXu-r0-QSh">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14113"/>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14490.70"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--Window Controller-->
<scene sceneID="xuk-b6-5Bv">
<objects>
<windowController id="RXu-r0-QSh" sceneMemberID="viewController">
<window key="window" title="QuickTerm" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" oneShot="NO" releasedWhenClosed="NO" showsToolbarButton="NO" visibleAtLaunch="NO" animationBehavior="default" id="lW3-ol-sfq">
<window key="window" title="QuickTerm" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" animationBehavior="default" id="lW3-ol-sfq">
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="196" y="240" width="480" height="270"/>
<rect key="screenRect" x="0.0" y="0.0" width="1440" height="878"/>
<value key="minSize" type="size" width="480" height="270"/>
<connections>
<outlet property="delegate" destination="RXu-r0-QSh" id="q91-Q2-Wot"/>
</connections>
Expand All @@ -34,27 +36,20 @@
<rect key="frame" x="0.0" y="0.0" width="480" height="270"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="q2b-bp-JZO">
<rect key="frame" x="18" y="234" width="107" height="18"/>
<buttonCell key="cell" type="check" title="Show in menu" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="cte-zj-2qv">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
</button>
<scrollView autohidesScrollers="YES" horizontalLineScroll="19" horizontalPageScroll="10" verticalLineScroll="19" verticalPageScroll="10" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="zo5-4p-X8C">
<rect key="frame" x="20" y="20" width="440" height="208"/>
<rect key="frame" x="20" y="20" width="440" height="201"/>
<clipView key="contentView" id="85y-Pv-QiO">
<rect key="frame" x="1" y="0.0" width="438" height="207"/>
<rect key="frame" x="1" y="0.0" width="438" height="200"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" multipleSelection="NO" emptySelection="NO" autosaveColumns="NO" typeSelect="NO" rowSizeStyle="automatic" headerView="qRY-v6-hEK" viewBased="YES" id="ayE-XS-Mp7">
<rect key="frame" x="0.0" y="0.0" width="438" height="184"/>
<rect key="frame" x="0.0" y="0.0" width="438" height="177"/>
<autoresizingMask key="autoresizingMask"/>
<size key="intercellSpacing" width="3" height="2"/>
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
<color key="gridColor" name="gridColor" catalog="System" colorSpace="catalog"/>
<tableColumns>
<tableColumn identifier="" width="116" minWidth="40" maxWidth="1000" id="hlf-yw-De4">
<tableColumn width="116" minWidth="40" maxWidth="1000" id="hlf-yw-De4">
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" title="Application">
<font key="font" metaFont="smallSystem"/>
<color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
Expand Down Expand Up @@ -87,7 +82,7 @@
</tableCellView>
</prototypeCellViews>
</tableColumn>
<tableColumn identifier="" width="316" minWidth="40" maxWidth="1000" id="kRU-Vg-7xU">
<tableColumn width="316" minWidth="40" maxWidth="1000" id="kRU-Vg-7xU">
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" title="Service">
<font key="font" metaFont="smallSystem"/>
<color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
Expand Down Expand Up @@ -124,11 +119,11 @@
</tableView>
</subviews>
</clipView>
<scroller key="horizontalScroller" hidden="YES" verticalHuggingPriority="750" horizontal="YES" id="xqb-4g-yhm">
<scroller key="horizontalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" horizontal="YES" id="xqb-4g-yhm">
<rect key="frame" x="1" y="119" width="223" height="15"/>
<autoresizingMask key="autoresizingMask"/>
</scroller>
<scroller key="verticalScroller" hidden="YES" verticalHuggingPriority="750" doubleValue="1" horizontal="NO" id="ixA-aN-03V">
<scroller key="verticalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" doubleValue="1" horizontal="NO" id="ixA-aN-03V">
<rect key="frame" x="224" y="17" width="15" height="102"/>
<autoresizingMask key="autoresizingMask"/>
</scroller>
Expand All @@ -137,13 +132,32 @@
<autoresizingMask key="autoresizingMask"/>
</tableHeaderView>
</scrollView>
<button horizontalHuggingPriority="750" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="8Q2-3u-R2z">
<rect key="frame" x="437" y="225" width="25" height="25"/>
<buttonCell key="cell" type="help" bezelStyle="helpButton" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="Ymp-O1-dds">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<action selector="helpButtonClicked:" target="TbM-HR-G7m" id="nVu-b7-RTJ"/>
</connections>
</button>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="q2b-bp-JZO">
<rect key="frame" x="18" y="227" width="156" height="18"/>
<buttonCell key="cell" type="check" title="Show in context menu" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="cte-zj-2qv">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
</button>
</subviews>
<constraints>
<constraint firstItem="q2b-bp-JZO" firstAttribute="leading" secondItem="rbi-8a-oJf" secondAttribute="leading" constant="20" id="4Hd-0H-vLg"/>
<constraint firstItem="8Q2-3u-R2z" firstAttribute="top" secondItem="rbi-8a-oJf" secondAttribute="top" constant="20" id="5Gv-pA-e2b"/>
<constraint firstItem="zo5-4p-X8C" firstAttribute="top" secondItem="q2b-bp-JZO" secondAttribute="bottom" constant="8" id="JF6-hu-AUf"/>
<constraint firstAttribute="trailing" secondItem="zo5-4p-X8C" secondAttribute="trailing" constant="20" id="O01-rH-4Mb"/>
<constraint firstAttribute="bottom" secondItem="zo5-4p-X8C" secondAttribute="bottom" constant="20" id="QQj-Um-Mhr"/>
<constraint firstItem="q2b-bp-JZO" firstAttribute="top" secondItem="rbi-8a-oJf" secondAttribute="top" constant="20" id="gUK-L9-4Nf"/>
<constraint firstAttribute="trailing" secondItem="8Q2-3u-R2z" secondAttribute="trailing" constant="20" id="fgp-pc-cRD"/>
<constraint firstItem="q2b-bp-JZO" firstAttribute="top" secondItem="rbi-8a-oJf" secondAttribute="top" constant="27" id="gUK-L9-4Nf"/>
<constraint firstItem="zo5-4p-X8C" firstAttribute="leading" secondItem="rbi-8a-oJf" secondAttribute="leading" constant="20" id="raA-l9-U5L"/>
</constraints>
</view>
Expand Down
4 changes: 0 additions & 4 deletions QuickTerm/QuickTerm.entitlements
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,9 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.application-groups</key>
<array>
<string>io.gitlab.terrylewis.OpenInTerminal.group</string>
</array>
<key>com.apple.security.files.user-selected.read-only</key>
<true/>
</dict>
</plist>
1 change: 1 addition & 0 deletions QuickTerm/SettingsViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@

@property(weak) IBOutlet NSButton *checkBoxContextMenu;
@property(weak) IBOutlet NSTableView *tableView;
- (IBAction)helpButtonClicked:(id)sender;

@end
60 changes: 51 additions & 9 deletions QuickTerm/SettingsViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#import "SettingsViewController.h"
#import "Settings.h"
#import "TerminalService.h"
#import <FinderSync/FinderSync.h>

@interface SettingsViewController () {
NSArray<TerminalService *> *_services;
Expand All @@ -23,33 +24,74 @@ @implementation SettingsViewController

- (void)viewDidLoad {
[super viewDidLoad];

BOOL contextMenuEnabled = Settings.sharedInstance.enableContextMenu;
self.checkBoxContextMenu.state = contextMenuEnabled ? NSOnState : NSOffState;
self.checkBoxContextMenu.target = self;
self.checkBoxContextMenu.action = @selector(checkBoxContextMenuClicked:);

self.tableView.target = self;
self.tableView.action = @selector(tableViewRowClicked:);
self.tableView.dataSource = self;
self.tableView.delegate = self;
[self setTableViewEnabled:contextMenuEnabled];;

}

- (void)viewDidAppear {
[super viewDidAppear];

_services = [Settings.sharedInstance.defaultServices copy];
[self.tableView reloadData];

for (NSUInteger i = 0; i < _services.count; ++i) {
TerminalService *service = _services[i];
if ([service.identifier isEqualToString:Settings.sharedInstance.activeServiceIdentifier]) {
NSIndexSet *indexSet = [NSIndexSet indexSetWithIndex:i];
[self.tableView selectRowIndexes:indexSet byExtendingSelection:NO];
}
}

// Prompt to enable the extension.
static NSString *settingsKey = @"ShownEnableExtensionAlert";
if (![self isExtensionEnabled] || ![NSUserDefaults.standardUserDefaults boolForKey:settingsKey]) {
[self promptToEnableExtension];
[NSUserDefaults.standardUserDefaults setBool:YES forKey:settingsKey];
}
}

- (BOOL)isExtensionEnabled {
if (@available(macOS 10.14, *)) {
return [FIFinderSyncController isExtensionEnabled];
} else {
// Assume it is enabled.
return YES;
}
}

- (void)promptToEnableExtension {
NSAlert *alert = [[NSAlert alloc] init];
alert.messageText = @"Enable Extension";
alert.informativeText = @"The QuickTerm Finder extension must be enabled in System Preferences";
[alert addButtonWithTitle:@"Open System Preferences"];
[alert beginSheetModalForWindow:self.view.window completionHandler:^(NSModalResponse returnCode) {
if (returnCode == NSAlertFirstButtonReturn) {
[self openSystemPreferences];
}
}];
}

- (void)openSystemPreferences {
if (@available(macOS 10.14, *)) {
[FIFinderSyncController showExtensionManagementInterface];
} else {
NSString *urlString = @"x-apple.systempreferences://";
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:urlString]];
}
}

- (IBAction)helpButtonClicked:(id)sender {
[self promptToEnableExtension];
}

- (void)setTableViewEnabled:(BOOL)enabled {
Expand All @@ -71,26 +113,26 @@ - (NSView *)tableView:(NSTableView *)tableView viewForTableColumn:(NSTableColumn
TerminalService *terminalService = _services[row];
NSString *cellIdentifier = nil;
NSString *displayString = nil;

if (tableColumn == tableView.tableColumns[0]) {
cellIdentifier = kIdentifierApplicationName;
displayString = terminalService.applicationName;
} else if (tableColumn == tableView.tableColumns[1]) {
cellIdentifier = kIdentifierServiceName;
displayString = terminalService.serviceName;
}

NSTableCellView *cell = [tableView makeViewWithIdentifier:cellIdentifier owner:nil];
cell.textField.stringValue = displayString;

return cell;
}

- (void)tableViewRowClicked:(NSTabView *)tableView {
NSUInteger selectedRow = self.tableView.selectedRow;
TerminalService *terminalService = _services[selectedRow];
Settings.sharedInstance.activeServiceIdentifier = terminalService.identifier;

}

@end
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"images" : [
{
"idiom" : "mac",
"filename" : "Toolbar Icon copy.pdf"
"filename" : "Toolbar Icon copy2.pdf"
}
],
"info" : {
Expand Down
Binary file not shown.
Binary file not shown.
Loading

0 comments on commit 32f69b0

Please sign in to comment.