adium 3051:d8ca91e7202b: Create media window controllers, add a ...
commits at adium.im
commits at adium.im
Fri Dec 11 00:59:45 UTC 2009
details: http://hg.adium.im/adium/rev/d8ca91e7202b
revision: 3051:d8ca91e7202b
author: Zachary West <zacw at adium.im>
date: Thu Dec 10 19:59:37 2009 -0500
Create media window controllers, add a media property to their protocol.
diffs (99 lines):
diff -r 2ea06555f231 -r d8ca91e7202b Frameworks/Adium Framework/Source/AIMediaControllerProtocol.h
--- a/Frameworks/Adium Framework/Source/AIMediaControllerProtocol.h Thu Dec 10 19:50:56 2009 -0500
+++ b/Frameworks/Adium Framework/Source/AIMediaControllerProtocol.h Thu Dec 10 19:59:37 2009 -0500
@@ -20,13 +20,14 @@
AIMediaStateRejected, /* Rejected call */
} AIMediaState;
+ at class AIMedia, AIListContact, AIAccount;
+
@protocol AIMediaWindowController
+ at property (readwrite, retain, nonatomic) AIMedia *media;
@property (readwrite, retain, nonatomic) NSView *outgoingVideo;
@property (readwrite, retain, nonatomic) NSView *incomingVideo;
@end
- at class AIMedia, AIListContact, AIAccount;
-
@protocol AIMediaController <AIController>
- (AIMedia *)mediaWithContact:(AIListContact *)contact
onAccount:(AIAccount *)account;
@@ -35,6 +36,7 @@
onAccount:(AIAccount *)account;
- (NSWindowController <AIMediaWindowController> *)windowControllerForMedia:(AIMedia *)media;
+- (void)closeMediaWindowController:(NSWindowController <AIMediaWindowController> *)mediaWindowController;
- (void)media:(AIMedia *)media didSetState:(AIMediaState)state;
diff -r 2ea06555f231 -r d8ca91e7202b Source/AIMediaController.h
--- a/Source/AIMediaController.h Thu Dec 10 19:50:56 2009 -0500
+++ b/Source/AIMediaController.h Thu Dec 10 19:59:37 2009 -0500
@@ -10,6 +10,7 @@
@interface AIMediaController : NSObject <AIMediaController> {
NSMutableArray *openMedias;
+ NSMutableArray *openMediaControllers;
}
@end
diff -r 2ea06555f231 -r d8ca91e7202b Source/AIMediaController.m
--- a/Source/AIMediaController.m Thu Dec 10 19:50:56 2009 -0500
+++ b/Source/AIMediaController.m Thu Dec 10 19:59:37 2009 -0500
@@ -8,17 +8,22 @@
#import "AIMediaController.h"
+#import <Adium/AIMediaControllerProtocol.h>
#import <Adium/AIMedia.h>
+#import "AIMediaWindowController.h"
+
@implementation AIMediaController
- (void)controllerDidLoad
{
openMedias = [[NSMutableArray alloc] init];
+ openMediaControllers = [[NSMutableArray alloc] init];
}
- (void)controllerWillClose
{
[openMedias release]; openMedias = nil;
+ [openMediaControllers release]; openMediaControllers = nil;
}
- (AIMedia *)mediaWithContact:(AIListContact *)contact
@@ -45,7 +50,22 @@
- (NSWindowController <AIMediaWindowController> *)windowControllerForMedia:(AIMedia *)media
{
- return nil;
+ for (NSWindowController <AIMediaWindowController> *windowController in openMediaControllers) {
+ if (windowController.media == media)
+ return windowController;
+ }
+
+ NSWindowController *windowController = [AIMediaWindowController mediaWindowControllerForMedia:media];
+ [openMediaControllers addObject:windowController];
+
+ return windowController;
+}
+
+- (void)closeMediaWindowController:(NSWindowController <AIMediaWindowController> *)mediaWindowController
+{
+ [[mediaWindowController retain] autorelease];
+
+ [openMediaControllers removeObject:mediaWindowController];
}
- (void)media:(AIMedia *)media didSetState:(AIMediaState)state
diff -r 2ea06555f231 -r d8ca91e7202b Source/AIMediaWindowController.h
--- a/Source/AIMediaWindowController.h Thu Dec 10 19:50:56 2009 -0500
+++ b/Source/AIMediaWindowController.h Thu Dec 10 19:59:37 2009 -0500
@@ -21,4 +21,6 @@
@property (readwrite, retain, nonatomic) NSView *outgoingVideo;
@property (readwrite, retain, nonatomic) NSView *incomingVideo;
++ (AIMediaWindowController *)mediaWindowControllerForMedia:(AIMedia *)media;
+
@end
More information about the commits
mailing list