Merge remote branch 'gui/master'

This commit is contained in:
Tony Garnock-Jones 2012-05-10 17:02:16 -04:00
commit e1cf3c0458
17 changed files with 2110 additions and 0 deletions

4
osx-server-gui/.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
.DS_Store
build
*.pbxuser
*.mode1v3

View File

@ -0,0 +1,43 @@
<html>
<head>
<title>Foo</title>
<style type="text/css">
body {
font-family: "Helvetica Neue", Helvetica, sans-serif;
}
h1, h2, h3, h4, h5, h6 {
text-align: center;
}
</style>
</head>
<body>
<p>
Hop is free software: you can redistribute it and/or modify it
under the terms of
the <a href="http://localhost:5678/gpl3.html">GNU General Public
License</a> as published by the Free Software Foundation, either
version 3 of the License, or (at your option) any later version.
</p>
<p>
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
</p>
<h4>Developers</h4>
<p>
The project is currently hosted on github at <a
href="http://github.com/tonyg/hop/">http://github.com/tonyg/hop/</a>.
Contact details for the author are <a
href="http://homepages.kcbbs.gen.nz/tonyg/contact.html">here</a>.
</p>
<h4>Build information</h4>
<ul>
<li>Build stamp @BUILD_STAMP@</li>
<li>@GUI_VERSION@</li>
<li>@SERVER_VERSION@</li>
</ul>
</body>
</html>

View File

@ -0,0 +1,2 @@
/* Localized versions of Info.plist keys */

File diff suppressed because it is too large Load Diff

BIN
osx-server-gui/Hop.icns Normal file

Binary file not shown.

44
osx-server-gui/Makefile Normal file
View File

@ -0,0 +1,44 @@
SERVER_PATH=../server
SERVER_BINARY=hop_server.native
SERVER_WEB=web
APP_NAME="Hop Server"
RELEASE_RESOURCES=build/Release/$(APP_NAME).app/Contents/Resources
DEBUG_RESOURCES=build/Debug/$(APP_NAME).app/Contents/Resources
BUILD_STAMP:=$(shell date +%Y%m%d-%H%M%S)
GUI_VERSION:=Hop OSX GUI revision git-$(shell git branch -v --abbrev=8 | grep '^\*' | awk '{print $$3}')
SERVER_VERSION:=Server revision git-$(shell cd $(SERVER_PATH); git branch -v --abbrev=8 | grep '^\*' | awk '{print $$3}')
release: $(SERVER_PATH)/$(SERVER_BINARY)
xcodebuild -configuration Release
cp $(SERVER_PATH)/$(SERVER_BINARY) $(RELEASE_RESOURCES)/.
sh ./fixup_shlibs.sh $(RELEASE_RESOURCES) $(SERVER_BINARY)
cp -rp $(SERVER_PATH)/$(SERVER_WEB) $(RELEASE_RESOURCES)/.
sed \
-e 's:@BUILD_STAMP@:$(BUILD_STAMP):g' \
-e 's:@GUI_VERSION@:$(GUI_VERSION):g' \
-e 's:@SERVER_VERSION@:$(SERVER_VERSION):g' \
$(RELEASE_RESOURCES)/English.lproj/Credits.html \
> $(RELEASE_RESOURCES)/English.lproj/Credits.html.tmp
mv \
$(RELEASE_RESOURCES)/English.lproj/Credits.html.tmp \
$(RELEASE_RESOURCES)/English.lproj/Credits.html
# /usr/libexec/PlistBuddy \
# -c "Set CFBundleShortVersionString $(GUI_VERSION)" \
# $(RELEASE_RESOURCES)/../Info.plist
# /usr/libexec/PlistBuddy \
# -c "Set CFBundleVersion $(SERVER_VERSION)" \
# $(RELEASE_RESOURCES)/../Info.plist
debug: $(SERVER_PATH)/$(SERVER_BINARY)
xcodebuild -configuration Debug
ln -sf $(CURDIR)/$(SERVER_PATH)/$(SERVER_BINARY) $(DEBUG_RESOURCES)/
ln -sf $(CURDIR)/$(SERVER_PATH)/$(SERVER_WEB) $(DEBUG_RESOURCES)/
$(SERVER_PATH)/$(SERVER_BINARY):
make -C $(SERVER_PATH)
clean:
rm -rf build

20
osx-server-gui/fixup_shlibs.sh Executable file
View File

@ -0,0 +1,20 @@
#!/bin/sh
RELEASE_RESOURCES="$1"
SERVER_BINARY="$2"
cd "$RELEASE_RESOURCES"
LIBEV_PATH=$(otool -L "$SERVER_BINARY" | grep 'libev.*dylib' | awk '{print $1}')
if [ ! -f "$LIBEV_PATH" ];
then
echo "Not rewriting LIBEV_PATH $LIBEV_PATH"
exit 0
fi
LIBEV_LOCAL=$(basename "$LIBEV_PATH")
cp $LIBEV_PATH $LIBEV_LOCAL
install_name_tool -change "$LIBEV_PATH" @loader_path/"$LIBEV_LOCAL" "$SERVER_BINARY"
otool -L "$SERVER_BINARY"

View File

@ -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>NSHumanReadableCopyright</key>
<string>Copyright © 2012 Tony Garnock-Jones</string>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIconFile</key>
<string>Hop.icns</string>
<key>CFBundleIdentifier</key>
<string>org.eighty-twenty.${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>Hop OSX GUI v0.0.1</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>prealpha</string>
<key>LSMinimumSystemVersion</key>
<string>${MACOSX_DEPLOYMENT_TARGET}</string>
<key>NSMainNibFile</key>
<string>MainMenu</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
</dict>
</plist>

View File

@ -0,0 +1,312 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 45;
objects = {
/* Begin PBXBuildFile section */
1DDD58160DA1D0A300B32029 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1DDD58140DA1D0A300B32029 /* MainMenu.xib */; };
256AC3DA0F4B6AC300CF3369 /* hopOsxAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 256AC3D90F4B6AC300CF3369 /* hopOsxAppDelegate.m */; };
8A3AD61B1550596B0083025A /* Hop.icns in Resources */ = {isa = PBXBuildFile; fileRef = 8A3AD61A1550596B0083025A /* Hop.icns */; };
8A78BA7015536F2D0063299E /* Credits.html in Resources */ = {isa = PBXBuildFile; fileRef = 8A78BA6E15536F2D0063299E /* Credits.html */; };
8AC89E371550397E00BACB4E /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8AC89E361550397E00BACB4E /* WebKit.framework */; };
8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */; };
8D11072D0486CEB800E47090 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; settings = {ATTRIBUTES = (); }; };
8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
089C165DFE840E0CC02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = "<group>"; };
1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; };
13E42FB307B3F0F600E4EEF1 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = /System/Library/Frameworks/CoreData.framework; sourceTree = "<absolute>"; };
1DDD58150DA1D0A300B32029 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/MainMenu.xib; sourceTree = "<group>"; };
256AC3D80F4B6AC300CF3369 /* hopOsxAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = hopOsxAppDelegate.h; sourceTree = "<group>"; };
256AC3D90F4B6AC300CF3369 /* hopOsxAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = hopOsxAppDelegate.m; sourceTree = "<group>"; };
256AC3F00F4B6AF500CF3369 /* hopOsx_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = hopOsx_Prefix.pch; sourceTree = "<group>"; };
29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
29B97324FDCFA39411CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = "<absolute>"; };
29B97325FDCFA39411CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; };
8A3AD61A1550596B0083025A /* Hop.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = Hop.icns; sourceTree = "<group>"; };
8A78BA6F15536F2D0063299E /* English */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; name = English; path = English.lproj/Credits.html; sourceTree = "<group>"; };
8AC89E361550397E00BACB4E /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = System/Library/Frameworks/WebKit.framework; sourceTree = SDKROOT; };
8D1107310486CEB800E47090 /* hopOsx-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "hopOsx-Info.plist"; sourceTree = "<group>"; };
8D1107320486CEB800E47090 /* Hop Server.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Hop Server.app"; sourceTree = BUILT_PRODUCTS_DIR; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
8D11072E0486CEB800E47090 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */,
8AC89E371550397E00BACB4E /* WebKit.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
080E96DDFE201D6D7F000001 /* Classes */ = {
isa = PBXGroup;
children = (
256AC3D80F4B6AC300CF3369 /* hopOsxAppDelegate.h */,
256AC3D90F4B6AC300CF3369 /* hopOsxAppDelegate.m */,
);
name = Classes;
sourceTree = "<group>";
};
1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */ = {
isa = PBXGroup;
children = (
1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */,
8AC89E361550397E00BACB4E /* WebKit.framework */,
);
name = "Linked Frameworks";
sourceTree = "<group>";
};
1058C7A2FEA54F0111CA2CBB /* Other Frameworks */ = {
isa = PBXGroup;
children = (
29B97324FDCFA39411CA2CEA /* AppKit.framework */,
13E42FB307B3F0F600E4EEF1 /* CoreData.framework */,
29B97325FDCFA39411CA2CEA /* Foundation.framework */,
);
name = "Other Frameworks";
sourceTree = "<group>";
};
19C28FACFE9D520D11CA2CBB /* Products */ = {
isa = PBXGroup;
children = (
8D1107320486CEB800E47090 /* Hop Server.app */,
);
name = Products;
sourceTree = "<group>";
};
29B97314FDCFA39411CA2CEA /* hopOsx */ = {
isa = PBXGroup;
children = (
080E96DDFE201D6D7F000001 /* Classes */,
29B97315FDCFA39411CA2CEA /* Other Sources */,
29B97317FDCFA39411CA2CEA /* Resources */,
29B97323FDCFA39411CA2CEA /* Frameworks */,
19C28FACFE9D520D11CA2CBB /* Products */,
);
name = hopOsx;
sourceTree = "<group>";
};
29B97315FDCFA39411CA2CEA /* Other Sources */ = {
isa = PBXGroup;
children = (
8A78BA6E15536F2D0063299E /* Credits.html */,
256AC3F00F4B6AF500CF3369 /* hopOsx_Prefix.pch */,
29B97316FDCFA39411CA2CEA /* main.m */,
8A3AD61A1550596B0083025A /* Hop.icns */,
);
name = "Other Sources";
sourceTree = "<group>";
};
29B97317FDCFA39411CA2CEA /* Resources */ = {
isa = PBXGroup;
children = (
8D1107310486CEB800E47090 /* hopOsx-Info.plist */,
089C165CFE840E0CC02AAC07 /* InfoPlist.strings */,
1DDD58140DA1D0A300B32029 /* MainMenu.xib */,
);
name = Resources;
sourceTree = "<group>";
};
29B97323FDCFA39411CA2CEA /* Frameworks */ = {
isa = PBXGroup;
children = (
1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */,
1058C7A2FEA54F0111CA2CBB /* Other Frameworks */,
);
name = Frameworks;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
8D1107260486CEB800E47090 /* Hop Server */ = {
isa = PBXNativeTarget;
buildConfigurationList = C01FCF4A08A954540054247B /* Build configuration list for PBXNativeTarget "Hop Server" */;
buildPhases = (
8D1107290486CEB800E47090 /* Resources */,
8D11072C0486CEB800E47090 /* Sources */,
8D11072E0486CEB800E47090 /* Frameworks */,
);
buildRules = (
);
dependencies = (
);
name = "Hop Server";
productInstallPath = "$(HOME)/Applications";
productName = "Hop Server";
productReference = 8D1107320486CEB800E47090 /* Hop Server.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
29B97313FDCFA39411CA2CEA /* Project object */ = {
isa = PBXProject;
attributes = {
ORGANIZATIONNAME = "Tony Garnock-Jones";
};
buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "hopOsx" */;
compatibilityVersion = "Xcode 3.1";
developmentRegion = English;
hasScannedForEncodings = 1;
knownRegions = (
English,
Japanese,
French,
German,
);
mainGroup = 29B97314FDCFA39411CA2CEA /* hopOsx */;
projectDirPath = "";
projectRoot = "";
targets = (
8D1107260486CEB800E47090 /* Hop Server */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
8D1107290486CEB800E47090 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */,
1DDD58160DA1D0A300B32029 /* MainMenu.xib in Resources */,
8A3AD61B1550596B0083025A /* Hop.icns in Resources */,
8A78BA7015536F2D0063299E /* Credits.html in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
8D11072C0486CEB800E47090 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
8D11072D0486CEB800E47090 /* main.m in Sources */,
256AC3DA0F4B6AC300CF3369 /* hopOsxAppDelegate.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXVariantGroup section */
089C165CFE840E0CC02AAC07 /* InfoPlist.strings */ = {
isa = PBXVariantGroup;
children = (
089C165DFE840E0CC02AAC07 /* English */,
);
name = InfoPlist.strings;
sourceTree = "<group>";
};
1DDD58140DA1D0A300B32029 /* MainMenu.xib */ = {
isa = PBXVariantGroup;
children = (
1DDD58150DA1D0A300B32029 /* English */,
);
name = MainMenu.xib;
sourceTree = "<group>";
};
8A78BA6E15536F2D0063299E /* Credits.html */ = {
isa = PBXVariantGroup;
children = (
8A78BA6F15536F2D0063299E /* English */,
);
name = Credits.html;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
C01FCF4B08A954540054247B /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
COPY_PHASE_STRIP = NO;
GCC_DYNAMIC_NO_PIC = NO;
GCC_ENABLE_FIX_AND_CONTINUE = YES;
GCC_MODEL_TUNING = G5;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = hopOsx_Prefix.pch;
INFOPLIST_FILE = "hopOsx-Info.plist";
INSTALL_PATH = "$(HOME)/Applications";
PRODUCT_NAME = "Hop Server";
};
name = Debug;
};
C01FCF4C08A954540054247B /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
GCC_MODEL_TUNING = G5;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = hopOsx_Prefix.pch;
INFOPLIST_FILE = "hopOsx-Info.plist";
INSTALL_PATH = "$(HOME)/Applications";
PRODUCT_NAME = "Hop Server";
};
name = Release;
};
C01FCF4F08A954540054247B /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
ONLY_ACTIVE_ARCH = YES;
PREBINDING = NO;
SDKROOT = macosx10.6;
};
name = Debug;
};
C01FCF5008A954540054247B /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
PREBINDING = NO;
SDKROOT = macosx10.6;
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
C01FCF4A08A954540054247B /* Build configuration list for PBXNativeTarget "Hop Server" */ = {
isa = XCConfigurationList;
buildConfigurations = (
C01FCF4B08A954540054247B /* Debug */,
C01FCF4C08A954540054247B /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
C01FCF4E08A954540054247B /* Build configuration list for PBXProject "hopOsx" */ = {
isa = XCConfigurationList;
buildConfigurations = (
C01FCF4F08A954540054247B /* Debug */,
C01FCF5008A954540054247B /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 29B97313FDCFA39411CA2CEA /* Project object */;
}

View File

@ -0,0 +1,32 @@
// Copyright 2012 Tony Garnock-Jones <tonygarnockjones@gmail.com>.
//
// This file is part of Hop.
//
// Hop is free software: you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by the
// Free Software Foundation, either version 3 of the License, or (at your
// option) any later version.
//
// Hop is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Hop. If not, see <http://www.gnu.org/licenses/>.
//
#import <Cocoa/Cocoa.h>
#import <WebKit/WebKit.h>
@interface hopOsxAppDelegate : NSObject <NSApplicationDelegate> {
NSWindow *window;
WebView *webview;
NSTask *task;
}
@property (assign) IBOutlet NSWindow *window;
@property (assign) IBOutlet WebView *webview;
@end

View File

@ -0,0 +1,106 @@
// Copyright 2012 Tony Garnock-Jones <tonygarnockjones@gmail.com>.
//
// This file is part of Hop.
//
// Hop is free software: you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by the
// Free Software Foundation, either version 3 of the License, or (at your
// option) any later version.
//
// Hop is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Hop. If not, see <http://www.gnu.org/licenses/>.
//
#import "hopOsxAppDelegate.h"
#include <sys/stat.h>
#define HOP_STARTUP_DEADLINE_SECONDS 30
@implementation hopOsxAppDelegate
@synthesize window;
@synthesize webview;
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
task = [NSTask new];
[[NSNotificationCenter defaultCenter]
addObserver: self
selector: @selector(mainWindowClosed:)
name: NSWindowWillCloseNotification
object: window];
[[NSNotificationCenter defaultCenter]
addObserver: self
selector: @selector(taskStatusChanged:)
name: NSTaskDidTerminateNotification
object: nil];
NSString *serverBinaryPath = [[NSBundle mainBundle] resourcePath];
[task setCurrentDirectoryPath: serverBinaryPath];
NSString *serverBinary = [serverBinaryPath stringByAppendingPathComponent: @"hop_server.native"];
[task setLaunchPath: serverBinary];
NSString *readyFile = [NSTemporaryDirectory() stringByAppendingPathComponent: @"hop.ready."];
readyFile = [readyFile stringByAppendingFormat: @"%d", getpid()];
char const *readyFileUtf8 = [readyFile UTF8String];
unlink(readyFileUtf8);
[task setArguments: [NSArray arrayWithObjects: @"--ready-file", readyFile, nil]];
@try {
[task launch];
}
@catch (NSException *e) {
NSLog(@"Could not launch server %@: %@", serverBinary, [e reason]);
[NSApp terminate: self];
@throw;
}
int foundReadyFile = 0;
time_t startTime = time(NULL);
while ([task isRunning] && time(NULL) - startTime < HOP_STARTUP_DEADLINE_SECONDS) {
struct stat s;
if (lstat(readyFileUtf8, &s) != -1) {
foundReadyFile = 1;
break;
}
if (errno != ENOENT) {
perror("lstat of readyFileUtf8");
exit(EXIT_FAILURE);
}
usleep(100000);
}
unlink(readyFileUtf8);
if (!foundReadyFile) {
NSLog(@"Server did not start up within %d seconds.", HOP_STARTUP_DEADLINE_SECONDS);
[NSApp terminate: self];
return;
}
[[webview mainFrame] loadRequest:
[NSURLRequest requestWithURL:
[NSURL URLWithString: @"http://localhost:5678/"]]];
}
- (void) applicationWillTerminate: (NSNotification *) notification {
if ([task isRunning]) {
[task terminate];
}
}
- (void) taskStatusChanged: (NSNotification *) aNotification {
[NSApp terminate: self];
}
- (void) mainWindowClosed: (NSNotification *) aNotification {
[NSApp terminate: self];
}
@end

View File

@ -0,0 +1,7 @@
//
// Prefix header for all source files of the 'hopOsx' target in the 'hopOsx' project
//
#ifdef __OBJC__
#import <Cocoa/Cocoa.h>
#endif

View File

@ -0,0 +1,4 @@
all: icon.css
%.css: %.less
recess --compile $< > $@

View File

@ -0,0 +1,29 @@
body {
background: #004400;
}
.icon {
width: 492px;
height: 492px;
padding: 0;
margin: 0;
font-family: "Helvetica Neue";
font-size: 240px;
line-height: 446px;
color: #ffffff;
text-align: center;
text-shadow: 0 5px 10px black;
background-color: #58a258;
background-image: linear-gradient(top, #74c474, #2f6f2f);
background-image: -ms-linear-gradient(top, #74c474, #2f6f2f);
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#74c474), to(#2f6f2f));
background-image: -webkit-linear-gradient(top, #74c474, #2f6f2f);
background-image: -o-linear-gradient(top, #74c474, #2f6f2f);
background-image: -moz-linear-gradient(top, #74c474, #2f6f2f);
background-repeat: repeat-x;
border: solid #285d28 10px;
-webkit-border-radius: 80px;
-moz-border-radius: 80px;
border-radius: 80px;
filter: progid:dximagetransform.microsoft.gradient(startColorstr='#74c474', endColorstr='#2f6f2f', GradientType=0);
}

View File

@ -0,0 +1,10 @@
<html>
<head>
<link rel="stylesheet" type="text/css" href="t.css">
</head>
<body>
<div class="icon">
hop
</div>
</body>
</html>

View File

@ -0,0 +1,49 @@
// -*- css -*-
@textColor: #fff;
@baseColor: #46a546;
@startColor: lighten(@baseColor, 15%);
@endColor: darken(@baseColor, 15%);
@borderWidth: 10px;
@borderColor: darken(@baseColor, 20%);
@transparencyColor: #040;
body {
background: @transparencyColor;
}
.icon {
width: 512px - @borderWidth * 2;
height: 512px - @borderWidth * 2;
padding: 0;
margin: 0;
border: solid @borderColor @borderWidth;
font-family: "Helvetica Neue";
font-size: 240px;
line-height: 466px - @borderWidth * 2;
color: @textColor;
text-shadow: 0px 5px 10px black;
text-align: center;
background-color: mix(@startColor, @endColor, 60%);
background-image: -moz-linear-gradient(top, @startColor, @endColor); // FF 3.6+
background-image: -ms-linear-gradient(top, @startColor, @endColor); // IE10
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(@startColor), to(@endColor)); // Safari 4+, Chrome 2+
background-image: -webkit-linear-gradient(top, @startColor, @endColor); // Safari 5.1+, Chrome 10+
background-image: -o-linear-gradient(top, @startColor, @endColor); // Opera 11.10
background-image: linear-gradient(top, @startColor, @endColor); // The standard
background-repeat: repeat-x;
-webkit-border-radius: 80px;
-moz-border-radius: 80px;
border-radius: 80px;
filter: e(%("progid:DXImageTransform.Microsoft.gradient(startColorstr='%d', endColorstr='%d', GradientType=0)",@startColor,@endColor)); // IE9 and down
}

24
osx-server-gui/main.m Normal file
View File

@ -0,0 +1,24 @@
// Copyright 2012 Tony Garnock-Jones <tonygarnockjones@gmail.com>.
//
// This file is part of Hop.
//
// Hop is free software: you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by the
// Free Software Foundation, either version 3 of the License, or (at your
// option) any later version.
//
// Hop is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Hop. If not, see <http://www.gnu.org/licenses/>.
//
#import <Cocoa/Cocoa.h>
int main(int argc, char *argv[])
{
return NSApplicationMain(argc, (const char **) argv);
}