Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
BarkyTheDog committed Jan 10, 2015
1 parent 1b40733 commit 7ede248
Show file tree
Hide file tree
Showing 13 changed files with 1,463 additions and 0 deletions.
423 changes: 423 additions & 0 deletions LauncherApp.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions LauncherApp/AppDelegate.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//
// AppDelegate.h
// LauncherApp
//
// Created by Philip Schneider on 1/10/15.
// Copyright (c) 2015 Code From Above, LLC. All rights reserved.
//

#import <Cocoa/Cocoa.h>

@interface AppDelegate : NSObject <NSApplicationDelegate>


@end

35 changes: 35 additions & 0 deletions LauncherApp/AppDelegate.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
//
// AppDelegate.m
// LauncherApp
//
// Created by Philip Schneider on 1/10/15.
// Copyright (c) 2015 Code From Above, LLC. All rights reserved.
//

#import "AppDelegate.h"
#import "LauncherViewController.h"

@interface AppDelegate ()

@property (weak) IBOutlet NSWindow *window;
@property (nonatomic, strong) IBOutlet LauncherViewController *launcherViewController;

@end

@implementation AppDelegate

- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
self.launcherViewController = [[LauncherViewController alloc] initWithNibName:@"LauncherViewController"
bundle:nil];

[self.window.contentView addSubview:self.launcherViewController.view];
self.launcherViewController.view.frame = ((NSView*)self.window.contentView).bounds;
}

- (void)applicationWillTerminate:(NSNotification *)aNotification {
// Insert code here to tear down your application
}

- (IBAction)testButton:(id)sender {
}
@end
682 changes: 682 additions & 0 deletions LauncherApp/Base.lproj/MainMenu.xib

Large diffs are not rendered by default.

58 changes: 58 additions & 0 deletions LauncherApp/Images.xcassets/AppIcon.appiconset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{
"images" : [
{
"idiom" : "mac",
"size" : "16x16",
"scale" : "1x"
},
{
"idiom" : "mac",
"size" : "16x16",
"scale" : "2x"
},
{
"idiom" : "mac",
"size" : "32x32",
"scale" : "1x"
},
{
"idiom" : "mac",
"size" : "32x32",
"scale" : "2x"
},
{
"idiom" : "mac",
"size" : "128x128",
"scale" : "1x"
},
{
"idiom" : "mac",
"size" : "128x128",
"scale" : "2x"
},
{
"idiom" : "mac",
"size" : "256x256",
"scale" : "1x"
},
{
"idiom" : "mac",
"size" : "256x256",
"scale" : "2x"
},
{
"idiom" : "mac",
"size" : "512x512",
"scale" : "1x"
},
{
"idiom" : "mac",
"size" : "512x512",
"scale" : "2x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
34 changes: 34 additions & 0 deletions LauncherApp/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIconFile</key>
<string></string>
<key>CFBundleIdentifier</key>
<string>com.codefromabove.$(PRODUCT_NAME:rfc1034identifier)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSMinimumSystemVersion</key>
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2015 Code From Above, LLC. All rights reserved.</string>
<key>NSMainNibFile</key>
<string>MainMenu</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
</dict>
</plist>
13 changes: 13 additions & 0 deletions LauncherApp/LauncherViewController.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//
// LauncherViewController.h
// LauncherApp
//
// Created by Philip Schneider on 1/10/15.
// Copyright (c) 2015 Code From Above, LLC. All rights reserved.
//

#import <Cocoa/Cocoa.h>

@interface LauncherViewController : NSViewController

@end
67 changes: 67 additions & 0 deletions LauncherApp/LauncherViewController.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
//
// LauncherViewController.m
// LauncherApp
//
// Created by Philip Schneider on 1/10/15.
// Copyright (c) 2015 Code From Above, LLC. All rights reserved.
//

#import "LauncherViewController.h"

@interface LauncherViewController ()
@property (weak) IBOutlet NSTextField *appOutlet;

@end

@implementation LauncherViewController

- (void)viewDidLoad
{
[super viewDidLoad];
// Do view setup here.
}


- (IBAction)browseAction:(id)sender
{
NSOpenPanel *openDialog = [NSOpenPanel openPanel];

[openDialog setCanChooseFiles:YES];
[openDialog setCanChooseDirectories:NO];
[openDialog setAllowsMultipleSelection:NO];
[openDialog setDirectoryURL:[NSURL URLWithString:@"/Applications"]];
[openDialog setAllowedFileTypes:[NSArray arrayWithObjects:@"app", nil]];

if ([openDialog runModal] == NSOKButton)
{
NSArray *urls = [openDialog URLs];
NSString *path = [urls objectAtIndex:0];
NSArray *pathComponents = [path pathComponents];
NSString *appName = [pathComponents lastObject];

[[self appOutlet] setStringValue:[appName stringByDeletingPathExtension]];
}
}

- (void)launchApp:(NSString *)app
{
if (app)
{
NSString *scriptCode = [NSString stringWithFormat:@"tell application \\\"%@\\\" to run", app];
NSString *commandLine = [NSString stringWithFormat:@"osascript -e \"%@\"", scriptCode];

int result = system([commandLine UTF8String]);

scriptCode = [NSString stringWithFormat:@"tell application \\\"%@\\\" to activate", app];
commandLine = [NSString stringWithFormat:@"osascript -e \"%@\"", scriptCode];

result = system([commandLine UTF8String]);
}
}

- (IBAction)launchAction:(id)sender
{
[self launchApp:[[self appOutlet] stringValue]];
}

@end
52 changes: 52 additions & 0 deletions LauncherApp/LauncherViewController.xib
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="6254" systemVersion="13F34" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="6254"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="LauncherViewController">
<connections>
<outlet property="appOutlet" destination="n7t-WN-gAH" id="Ejl-AP-sjz"/>
<outlet property="view" destination="Hz6-mo-xeY" id="0bl-1N-x8E"/>
</connections>
</customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<customView id="Hz6-mo-xeY">
<rect key="frame" x="0.0" y="0.0" width="459" height="126"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<subviews>
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="0LV-jG-m6U">
<rect key="frame" x="192" y="26" width="85" height="32"/>
<buttonCell key="cell" type="push" title="Launch" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="vv9-ba-o7k">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<action selector="launchAction:" target="-2" id="5iI-Ca-978"/>
</connections>
</button>
<textField verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="n7t-WN-gAH">
<rect key="frame" x="63" y="72" width="242" height="22"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" drawsBackground="YES" id="JM8-hp-7OY">
<font key="font" metaFont="system"/>
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="JR1-Mj-F2l">
<rect key="frame" x="314" y="65" width="85" height="32"/>
<buttonCell key="cell" type="push" title="Browse" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="eDZ-co-hM2">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<action selector="browseAction:" target="-2" id="cd4-64-0Ox"/>
</connections>
</button>
</subviews>
<point key="canvasLocation" x="129.5" y="82"/>
</customView>
</objects>
</document>
13 changes: 13 additions & 0 deletions LauncherApp/main.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//
// main.m
// LauncherApp
//
// Created by Philip Schneider on 1/10/15.
// Copyright (c) 2015 Code From Above, LLC. All rights reserved.
//

#import <Cocoa/Cocoa.h>

int main(int argc, const char * argv[]) {
return NSApplicationMain(argc, argv);
}
24 changes: 24 additions & 0 deletions LauncherAppTests/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>com.codefromabove.$(PRODUCT_NAME:rfc1034identifier)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
</plist>
40 changes: 40 additions & 0 deletions LauncherAppTests/LauncherAppTests.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
//
// LauncherAppTests.m
// LauncherAppTests
//
// Created by Philip Schneider on 1/10/15.
// Copyright (c) 2015 Code From Above, LLC. All rights reserved.
//

#import <Cocoa/Cocoa.h>
#import <XCTest/XCTest.h>

@interface LauncherAppTests : XCTestCase

@end

@implementation LauncherAppTests

- (void)setUp {
[super setUp];
// Put setup code here. This method is called before the invocation of each test method in the class.
}

- (void)tearDown {
// Put teardown code here. This method is called after the invocation of each test method in the class.
[super tearDown];
}

- (void)testExample {
// This is an example of a functional test case.
XCTAssert(YES, @"Pass");
}

- (void)testPerformanceExample {
// This is an example of a performance test case.
[self measureBlock:^{
// Put the code you want to measure the time of here.
}];
}

@end

0 comments on commit 7ede248

Please sign in to comment.