Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
git-svn-id: svn+ssh://svn.sjaak.org/svn/cocoa/QTXAutoPlayFullscreen@6 45e13784-c24c-4e74-a713-ebf2ec6a0b5c
- Loading branch information
sjaak
committed
Jan 13, 2010
0 parents
commit 28bce3f
Showing
49 changed files
with
3,572 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/* Localized versions of Info.plist keys */ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?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>English</string> | ||
<key>CFBundleExecutable</key> | ||
<string>${EXECUTABLE_NAME}</string> | ||
<key>CFBundleName</key> | ||
<string>${PRODUCT_NAME}</string> | ||
<key>CFBundleIconFile</key> | ||
<string></string> | ||
<key>CFBundleIdentifier</key> | ||
<string>org.sjaak.simbl.QTXAutoPlayFullscreen</string> | ||
<key>CFBundleInfoDictionaryVersion</key> | ||
<string>6.0</string> | ||
<key>CFBundlePackageType</key> | ||
<string>BNDL</string> | ||
<key>CFBundleSignature</key> | ||
<string>????</string> | ||
<key>CFBundleVersion</key> | ||
<string>1.0</string> | ||
<key>CFBundleShortVersionString</key> | ||
<string>1.0</string> | ||
<key>SIMBLTargetApplications</key> | ||
<array> | ||
<dict> | ||
<key>BundleIdentifier</key> | ||
<string>com.apple.QuickTimePlayerX</string> | ||
<key>MaxBundleVersion</key> | ||
<string>90.3.1</string> | ||
<key>MinBundleVersion</key> | ||
<string>51</string> | ||
</dict> | ||
</array> | ||
<key>NSPrincipalClass</key> | ||
<string>QTXAutoPlayFullscreen</string> | ||
</dict> | ||
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// | ||
// QTXAutoPlayFullscreenMGDocumentWindowController.h | ||
// QTXAutoPlayFullscreen | ||
// | ||
// Created by Marcel Vingerling on 09-10-09. | ||
// Copyright 2009 Strawberries. All rights reserved. | ||
// | ||
|
||
#import <Cocoa/Cocoa.h> | ||
|
||
extern NSString *QTX_AUTOPLAY_USER_DEFAULT_KEY; | ||
extern NSString *QTX_AUTORESIGN_USER_DEFAULT_KEY; | ||
|
||
@interface NSObject (QTXAutoPlayFullscreenHook) | ||
|
||
- (void) QTXAutoPlayFullscreen_toggleFullScreen:(id)arg1; | ||
- (void) setFullScreen: (BOOL) arg; | ||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
// | ||
// QTXAutoPlayFullscreenMGDocumentWindowController.m | ||
// QTXAutoPlayFullscreen | ||
// | ||
// Created by Marcel Vingerling on 09-10-09. | ||
// Copyright 2009 Strawberries. All rights reserved. | ||
// | ||
#import <Foundation/Foundation.h> | ||
#import "NSObject+QTXAutoPlayFullscreenHook.h" | ||
#import <QTKit/QTKit.h> | ||
|
||
|
||
NSString *QTX_AUTOPLAY_USER_DEFAULT_KEY = @"QTXAutoPlayFullscreenEnabled"; | ||
NSString *QTX_AUTORESIGN_USER_DEFAULT_KEY = @"QTXAutoResignFullscreenEnabled"; | ||
|
||
@implementation NSObject (QTXAutoPlayFullscreenHook) | ||
|
||
- (void) QTXAutoPlayFullscreen_dealloc { | ||
if ([[NSUserDefaults standardUserDefaults] boolForKey:QTX_AUTORESIGN_USER_DEFAULT_KEY]) { | ||
[[NSNotificationCenter defaultCenter] removeObserver:self name:QTMovieDidEndNotification object:[[self performSelector:@selector(document)] performSelector:@selector(movie)]]; | ||
} | ||
// will call the swizzled method after bundle has loaded. | ||
[self QTXAutoPlayFullscreen_dealloc]; | ||
} | ||
|
||
- (void) QTXAutoPlayFullscreen_toggleFullScreen:(id)arg1 | ||
{ | ||
// will call the swizzled method after bundle has loaded. | ||
[self QTXAutoPlayFullscreen_toggleFullScreen:arg1]; | ||
|
||
[self performSelectorInBackground:@selector(QTXAutoPlayFullscreen_handleautoplay) withObject:self]; | ||
} | ||
|
||
- (void) QTXAutoPlayFullscreen_resignFullscreen: (NSNotification *)notification | ||
{ | ||
|
||
if ([[NSUserDefaults standardUserDefaults] boolForKey:QTX_AUTORESIGN_USER_DEFAULT_KEY]) { | ||
// will call overridden method | ||
[self setFullScreen: NO]; | ||
[[NSNotificationCenter defaultCenter] removeObserver:self | ||
name:QTMovieDidEndNotification | ||
object:[[self performSelector:@selector(document)] performSelector:@selector(movie)]]; | ||
} | ||
|
||
} | ||
|
||
- (void) setFullScreen: (BOOL) arg | ||
{ | ||
// do nothing | ||
NSLog(@"Should never be called"); | ||
} | ||
|
||
- (void) QTXAutoPlayFullscreen_handleautoplay { | ||
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; | ||
if ([[NSUserDefaults standardUserDefaults] boolForKey:QTX_AUTOPLAY_USER_DEFAULT_KEY] && [self performSelector:@selector(isFullScreen)]) { | ||
id document = [self performSelector:@selector(document)]; | ||
QTMovie *movie = [document performSelector:@selector(movie)]; | ||
float rate = [movie rate]; | ||
if (rate == 0.0) { | ||
[movie performSelector:@selector(autoplay)]; | ||
} | ||
if ([[NSUserDefaults standardUserDefaults] boolForKey:QTX_AUTORESIGN_USER_DEFAULT_KEY]) { | ||
|
||
[[NSNotificationCenter defaultCenter] addObserver:self | ||
selector: @selector(QTXAutoPlayFullscreen_resignFullscreen:) | ||
name:QTMovieDidEndNotification | ||
object:[[self performSelector:@selector(document)] performSelector:@selector(movie)]]; | ||
} | ||
} | ||
[pool release]; | ||
} | ||
|
||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// | ||
// QTXAutoPlayFullscreen.h | ||
// QTXAutoPlayFullscreen | ||
// | ||
// Created by Marcel Vingerling on 09-10-09. | ||
// Copyright 2009 Strawberries. All rights reserved. | ||
// | ||
|
||
#import <Cocoa/Cocoa.h> | ||
|
||
|
||
@interface QTXAutoPlayFullscreen : NSObject { | ||
|
||
} | ||
+ (void) load; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// | ||
// QTXAutoPlayFullscreen.m | ||
// QTXAutoPlayFullscreen | ||
// | ||
// Created by Marcel Vingerling on 09-10-09. | ||
// Copyright 2009 Strawberries. All rights reserved. | ||
// | ||
|
||
#import <objc/runtime.h> | ||
#import "QTXAutoPlayFullscreen.h" | ||
#import "NSObject+QTXAutoPlayFullscreenHook.h" | ||
|
||
@implementation QTXAutoPlayFullscreen | ||
|
||
+(void) load | ||
{ | ||
Method oldHook = class_getInstanceMethod(objc_getClass("MGDocumentWindowController"), @selector(toggleFullScreen:)); | ||
Method newHook = class_getInstanceMethod(objc_getClass("MGDocumentWindowController"), @selector(QTXAutoPlayFullscreen_toggleFullScreen:)); | ||
method_exchangeImplementations(oldHook, newHook); | ||
|
||
|
||
Method oldDealloc = class_getInstanceMethod(objc_getClass("MGDocumentWindowController"), @selector(dealloc)); | ||
Method newDealloc = class_getInstanceMethod(objc_getClass("MGDocumentWindowController"), @selector(QTXAutoPlayFullscreen_dealloc)); | ||
method_exchangeImplementations(oldDealloc, newDealloc); | ||
|
||
NSLog(@"QTXAutoPlayFullscreen is now active"); | ||
|
||
if (nil == [[NSUserDefaults standardUserDefaults] objectForKey:QTX_AUTOPLAY_USER_DEFAULT_KEY]) { | ||
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:QTX_AUTOPLAY_USER_DEFAULT_KEY]; | ||
[[NSUserDefaults standardUserDefaults] synchronize]; | ||
NSLog(@"Created userdefault key: %@", QTX_AUTOPLAY_USER_DEFAULT_KEY); | ||
} | ||
|
||
if (nil == [[NSUserDefaults standardUserDefaults] objectForKey:QTX_AUTORESIGN_USER_DEFAULT_KEY]) { | ||
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:QTX_AUTORESIGN_USER_DEFAULT_KEY]; | ||
[[NSUserDefaults standardUserDefaults] synchronize]; | ||
NSLog(@"Created userdefault key: %@", QTX_AUTORESIGN_USER_DEFAULT_KEY); | ||
} | ||
|
||
|
||
|
||
} | ||
|
||
@end |
Oops, something went wrong.