Improving mac client feedback and interaction a little

updating copyright no controller, app delegate
adding app icon
This commit is contained in:
pcrawfor
2011-03-17 09:05:52 -04:00
parent 89747dd446
commit 485ee60d83
8 changed files with 314 additions and 689 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -1,10 +1,24 @@
//
// MainController.h
// fayeMac
//
// Created by Paul Crawford on 3/4/11.
// Copyright 2011 __MyCompanyName__. All rights reserved.
//
/* The MIT License
Copyright (c) 2011 Paul Crawford
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. */
#import <Cocoa/Cocoa.h>
#import "FayeClient.h"
@@ -21,6 +35,7 @@
NSString *serverChannelString;
BOOL connected;
NSImageView *connectIndicator;
NSTextField *statusLabel;
}
@property (retain) IBOutlet NSTextView *messagesText;
@@ -34,8 +49,13 @@
@property (retain) NSString *serverChannelString;
@property (assign) BOOL connected;
@property (retain) IBOutlet NSImageView *connectIndicator;
@property (retain) IBOutlet NSTextField *statusLabel;
- (IBAction) connectToServer:(id)sender;
- (IBAction) sendMessage:(id)sender;
- (IBAction) clearLog:(id)sender;
- (void) disableFields;
- (void) enableFields;
- (void) addLogMessage:(NSString *)message;
@end

View File

@@ -1,10 +1,24 @@
//
// MainController.m
// fayeMac
//
// Created by Paul Crawford on 3/4/11.
// Copyright 2011 __MyCompanyName__. All rights reserved.
//
/* The MIT License
Copyright (c) 2011 Paul Crawford
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. */
#import "MainController.h"
#import "fayeMacAppDelegate.h"
@@ -25,6 +39,7 @@
@synthesize serverChannelString;
@synthesize connected;
@synthesize connectIndicator;
@synthesize statusLabel;
- (void) awakeFromNib {
DLog(@"MainController firing up");
@@ -41,6 +56,7 @@
[self.messageField setTarget:self];
[self.messageField setAction:@selector(sendMessage:)];
self.statusLabel.stringValue = @"";
}
#pragma mark -
@@ -48,22 +64,39 @@
- (void) messageReceived:(NSDictionary *)messageDict {
DLog(@"message recieved");
if([messageDict objectForKey:@"message"]) {
[self.messagesText insertText:[NSString stringWithFormat:@"%@\n", [messageDict objectForKey:@"message"]]];
[self addLogMessage:[messageDict objectForKey:@"message"]];
}
}
- (void)connectedToServer {
[self addLogMessage:@"**** Connected to server ****"];
self.connected = YES;
[self.connectIndicator setImage:[NSImage imageNamed:@"green.png"]];
[self.connectBtn setTitle:@"Disconnect"];
[connectBtn setAction:@selector(disconnectFromServer:)];
[self disableFields];
self.statusLabel.stringValue = [NSString stringWithFormat:@"Subscribed to channel: %@", self.channelField.stringValue];
}
- (void)disconnectedFromServer {
if(self.connected)
[self addLogMessage:@"**** Disconnected from server ****"];
[self enableFields];
self.connected = NO;
[self.connectIndicator setImage:[NSImage imageNamed:@"red.png"]];
[self.connectBtn setTitle:@"Connect"];
[connectBtn setAction:@selector(connectToServer:)];
self.statusLabel.stringValue = @"Disconnected";
}
- (void) disableFields {
[self.serverField setEnabled:NO];
[self.channelField setEnabled:NO];
}
- (void) enableFields {
[self.serverField setEnabled:YES];
[self.channelField setEnabled:YES];
}
#pragma mark -
@@ -125,6 +158,15 @@
[self.faye publishDict:messageDict];
}
- (IBAction) clearLog:(id)sender {
DLog(@"Clear Log");
[self.messagesText setString:@""];
}
- (void) addLogMessage:(NSString *)message {
[self.messagesText insertText:[NSString stringWithFormat:@"%@\n", message]];
}
- (void) dealloc
{
self.messagesText = nil;

View File

@@ -7,7 +7,7 @@
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIconFile</key>
<string></string>
<string>fayeMac.icns</string>
<key>CFBundleIdentifier</key>
<string>com.yourcompany.${PRODUCT_NAME:rfc1034identifier}</string>
<key>CFBundleInfoDictionaryVersion</key>

BIN
fayeMac/fayeMac.icns Normal file

Binary file not shown.

View File

@@ -9,6 +9,7 @@
/* Begin PBXBuildFile section */
1DDD58160DA1D0A300B32029 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1DDD58140DA1D0A300B32029 /* MainMenu.xib */; };
256AC3DA0F4B6AC300CF3369 /* fayeMacAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 256AC3D90F4B6AC300CF3369 /* fayeMacAppDelegate.m */; };
5D196E0D132FBF1900DF141C /* fayeMac.icns in Resources */ = {isa = PBXBuildFile; fileRef = 5D196E0C132FBF1900DF141C /* fayeMac.icns */; };
5DD10076132118ED00E49150 /* CoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5DD10075132118ED00E49150 /* CoreServices.framework */; };
5DD102ED13213B1F00E49150 /* MainController.m in Sources */ = {isa = PBXBuildFile; fileRef = 5DD102EC13213B1F00E49150 /* MainController.m */; };
5DD10431132183C600E49150 /* green.png in Resources */ = {isa = PBXBuildFile; fileRef = 5DD1042F132183C600E49150 /* green.png */; };
@@ -60,6 +61,7 @@
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>"; };
5D196E0C132FBF1900DF141C /* fayeMac.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = fayeMac.icns; sourceTree = "<group>"; };
5DD10075132118ED00E49150 /* CoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreServices.framework; path = System/Library/Frameworks/CoreServices.framework; sourceTree = SDKROOT; };
5DD102EB13213B1F00E49150 /* MainController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MainController.h; sourceTree = "<group>"; };
5DD102EC13213B1F00E49150 /* MainController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MainController.m; sourceTree = "<group>"; };
@@ -179,6 +181,7 @@
29B97317FDCFA39411CA2CEA /* Resources */ = {
isa = PBXGroup;
children = (
5D196E0C132FBF1900DF141C /* fayeMac.icns */,
5DD1042E132183C600E49150 /* images */,
8D1107310486CEB800E47090 /* fayeMac-Info.plist */,
089C165CFE840E0CC02AAC07 /* InfoPlist.strings */,
@@ -356,6 +359,7 @@
5DD10432132183C600E49150 /* red.png in Resources */,
5DD104C61321886400E49150 /* AsyncSocket Documentation.html in Resources */,
5DD104C91321886400E49150 /* changes.txt in Resources */,
5D196E0D132FBF1900DF141C /* fayeMac.icns in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};

View File

@@ -1,10 +1,24 @@
//
// fayeMacAppDelegate.h
// fayeMac
//
// Created by Paul Crawford on 3/3/11.
// Copyright 2011 __MyCompanyName__. All rights reserved.
//
/* The MIT License
Copyright (c) 2011 Paul Crawford
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. */
#import <Cocoa/Cocoa.h>

View File

@@ -1,10 +1,24 @@
//
// fayeMacAppDelegate.m
// fayeMac
//
// Created by Paul Crawford on 3/3/11.
// Copyright 2011 __MyCompanyName__. All rights reserved.
//
/* The MIT License
Copyright (c) 2011 Paul Crawford
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. */
#import "fayeMacAppDelegate.h"