require 10.6 (and Xcode 3.2) for development, and kill some more deprecated methods too

This commit is contained in:
Mitchell Livingston 2009-08-29 20:28:52 +00:00
parent bafff356a6
commit 74bcaba766
8 changed files with 99 additions and 32 deletions

View File

@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 45;
objectVersion = 46;
objects = {
/* Begin PBXBuildFile section */
@ -164,6 +164,7 @@
A29AF4F90D01BAEB00D097EC /* UpArrowTemplate.png in Resources */ = {isa = PBXBuildFile; fileRef = A29AF4F80D01BAEB00D097EC /* UpArrowTemplate.png */; };
A29B0C270BD15FEF0006F230 /* Credits.rtf in Resources */ = {isa = PBXBuildFile; fileRef = A2F8951E0A2D4BA500ED2127 /* Credits.rtf */; };
A29C8B370ACC6EB3000ED9F9 /* PortChecker.m in Sources */ = {isa = PBXBuildFile; fileRef = A29C8B350ACC6EB3000ED9F9 /* PortChecker.m */; };
A29D84041049C25600D1987A /* NSApplicationAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = A29D84031049C25600D1987A /* NSApplicationAdditions.m */; };
A29DF8B90DB2544C00D04E5A /* resume.c in Sources */ = {isa = PBXBuildFile; fileRef = A29DF8B60DB2544C00D04E5A /* resume.c */; };
A29DF8BA0DB2544C00D04E5A /* resume.h in Headers */ = {isa = PBXBuildFile; fileRef = A29DF8B70DB2544C00D04E5A /* resume.h */; };
A29DF8BB0DB2544C00D04E5A /* torrent.h in Headers */ = {isa = PBXBuildFile; fileRef = A29DF8B80DB2544C00D04E5A /* torrent.h */; };
@ -627,6 +628,8 @@
A29AF4F80D01BAEB00D097EC /* UpArrowTemplate.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = UpArrowTemplate.png; path = macosx/Images/UpArrowTemplate.png; sourceTree = "<group>"; };
A29C8B340ACC6EB3000ED9F9 /* PortChecker.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = PortChecker.h; path = macosx/PortChecker.h; sourceTree = "<group>"; };
A29C8B350ACC6EB3000ED9F9 /* PortChecker.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = PortChecker.m; path = macosx/PortChecker.m; sourceTree = "<group>"; };
A29D84021049C25600D1987A /* NSApplicationAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NSApplicationAdditions.h; path = macosx/NSApplicationAdditions.h; sourceTree = "<group>"; };
A29D84031049C25600D1987A /* NSApplicationAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = NSApplicationAdditions.m; path = macosx/NSApplicationAdditions.m; sourceTree = "<group>"; };
A29DF8B60DB2544C00D04E5A /* resume.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = resume.c; path = libtransmission/resume.c; sourceTree = "<group>"; };
A29DF8B70DB2544C00D04E5A /* resume.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = resume.h; path = libtransmission/resume.h; sourceTree = "<group>"; };
A29DF8B80DB2544C00D04E5A /* torrent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = torrent.h; path = libtransmission/torrent.h; sourceTree = "<group>"; };
@ -899,6 +902,8 @@
children = (
32CA4F630368D1EE00C91783 /* Transmission_Prefix.pch */,
29B97316FDCFA39411CA2CEA /* main.m */,
A29D84021049C25600D1987A /* NSApplicationAdditions.h */,
A29D84031049C25600D1987A /* NSApplicationAdditions.m */,
4DF0C5AA0899190500DD8943 /* Controller.h */,
4DF0C5A90899190500DD8943 /* Controller.m */,
4DFBC2DD09C0970D00D5C571 /* Torrent.h */,
@ -1673,9 +1678,10 @@
isa = PBXProject;
attributes = {
BuildIndependentTargetsInParallel = YES;
ORGANIZATIONNAME = "The Transmission Project";
};
buildConfigurationList = 4DF0C59A089918A300DD8943 /* Build configuration list for PBXProject "Transmission" */;
compatibilityVersion = "Xcode 3.1";
compatibilityVersion = "Xcode 3.2";
hasScannedForEncodings = 1;
knownRegions = (
English,
@ -1983,6 +1989,7 @@
A222EA7B0E6C32C4009FB003 /* BlocklistScheduler.m in Sources */,
A232F07E0EEA034A00041646 /* BonjourController.m in Sources */,
A23F526F0F14395900AA02E3 /* PredicateEditorRowTemplateAny.m in Sources */,
A29D84041049C25600D1987A /* NSApplicationAdditions.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -2367,7 +2374,7 @@
OTHER_LDFLAGS = "";
PREBINDING = NO;
PRELINK_LIBS = "";
SDKROOT = macosx10.5;
SDKROOT = macosx10.6;
STRIP_INSTALLED_PRODUCT = NO;
VALID_ARCHS = "i386 ppc ppc7400 ppc970 x86_64";
};
@ -2508,7 +2515,7 @@
MACOSX_DEPLOYMENT_TARGET = 10.5;
OTHER_LDFLAGS = "";
PREBINDING = NO;
SDKROOT = macosx10.5;
SDKROOT = macosx10.6;
VALID_ARCHS = "i386 ppc ppc7400 ppc970 x86_64";
};
name = Release;
@ -2598,7 +2605,7 @@
MACOSX_DEPLOYMENT_TARGET = 10.5;
OTHER_LDFLAGS = "";
PREBINDING = NO;
SDKROOT = macosx10.5;
SDKROOT = macosx10.6;
STRIP_INSTALLED_PRODUCT = NO;
VALID_ARCHS = "i386 ppc ppc7400 ppc970 x86_64";
};

View File

@ -394,10 +394,7 @@ typedef enum
[fFileController setTorrent: torrent];
NSImage * icon = [[torrent icon] copy];
[icon setFlipped: NO];
[fImageView setImage: icon];
[icon release];
[fImageView setImage: [torrent icon]];
NSString * name = [torrent name];
[fNameField setStringValue: name];

View File

@ -0,0 +1,29 @@
/******************************************************************************
* $Id$
*
* Copyright (c) 2009 Transmission authors and contributors
*
* 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.
*****************************************************************************/
@interface NSApplication (NSApplicationAdditions)
- (BOOL) isOnSnowLeopardOrBetter;
@end

View File

@ -0,0 +1,34 @@
/******************************************************************************
* $Id$
*
* Copyright (c) 2009 Transmission authors and contributors
*
* 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 "NSApplicationAdditions.h"
@implementation NSApplication (NSApplicationAdditions)
- (BOOL) isOnSnowLeopardOrBetter
{
return floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_5;
}
@end

View File

@ -26,6 +26,7 @@
#import "QuickLook.h"
#define QLPreviewPanel NSClassFromString(@"QLPreviewPanel")
#import "NSApplicationAdditions.h"
#import "Controller.h"
#import "InfoWindowController.h"
@ -147,8 +148,7 @@ QuickLookController * fQuickLookInstance = nil;
//load the QuickLook framework and set the delegate
//animation types: 0 = none; 1 = fade; 2 = zoom
//disable on Snow Leopard for now
const NSInteger appKitVersionNumber10_5 = 949;
fQuickLookAvailable = floor(NSAppKitVersionNumber) <= appKitVersionNumber10_5
fQuickLookAvailable = ![NSApp isOnSnowLeopardOrBetter]
&& [[NSBundle bundleWithPath: @"/System/Library/PrivateFrameworks/QuickLookUI.framework"] load];
if (fQuickLookAvailable)
[[[QLPreviewPanel sharedPreviewPanel] windowController] setDelegate: self];

View File

@ -653,11 +653,8 @@ int trashDataFile(const char * filename)
- (NSImage *) icon
{
if (!fIcon)
{
fIcon = [[[NSWorkspace sharedWorkspace] iconForFileType: [self isFolder] ? NSFileTypeForHFSTypeCode('fldr')
: [[self name] pathExtension]] retain];
[fIcon setFlipped: YES];
}
return fIcon;
}

View File

@ -25,7 +25,6 @@
@interface TorrentCell : NSActionCell
{
NSUserDefaults * fDefaults;
NSImage * fErrorImage;
NSMutableDictionary * fTitleAttributes, * fStatusAttributes;

View File

@ -25,6 +25,7 @@
#import "TorrentCell.h"
#import "TorrentTableView.h"
#import "GroupsController.h"
#import "NSApplicationAdditions.h"
#import "NSStringAdditions.h"
#import "ProgressGradients.h"
@ -78,6 +79,8 @@
- (NSString *) statusString;
- (NSString *) minimalStatusString;
- (void) drawImage: (NSImage *) image inRect: (NSRect) rect; //use until 10.5 dropped
@end
@implementation TorrentCell
@ -420,24 +423,20 @@
//error image
const BOOL error = [torrent isErrorOrWarning];
if (error && !fErrorImage)
{
fErrorImage = [NSImage imageNamed: @"Error.png"];
[fErrorImage setFlipped: YES];
}
NSImage * errorImage = error ? [NSImage imageNamed: @"Error.png"] : nil;
//icon
if (!minimal || !(!fTracking && fHoverAction)) //don't show in minimal mode when hovered over
{
NSImage * icon = (minimal && error) ? fErrorImage : [torrent icon];
[icon drawInRect: iconRect fromRect: NSZeroRect operation: NSCompositeSourceOver fraction: 1.0f];
NSImage * icon = (minimal && error) ? errorImage : [torrent icon];
[self drawImage: icon inRect: iconRect];
}
if (error && !minimal)
{
NSRect errorRect = NSMakeRect(NSMaxX(iconRect) - IMAGE_SIZE_MIN, NSMaxY(iconRect) - IMAGE_SIZE_MIN,
IMAGE_SIZE_MIN, IMAGE_SIZE_MIN);
[fErrorImage drawInRect: errorRect fromRect: NSZeroRect operation: NSCompositeSourceOver fraction: 1.0f];
[self drawImage: errorImage inRect: errorRect];
}
//text color
@ -510,9 +509,7 @@
controlImage = [NSImage imageNamed: [@"Resume" stringByAppendingString: controlImageSuffix]];
}
[controlImage setFlipped: YES];
[controlImage drawInRect: [self controlButtonRectForBounds: cellFrame] fromRect: NSZeroRect operation: NSCompositeSourceOver
fraction: 1.0f];
[self drawImage: controlImage inRect: [self controlButtonRectForBounds: cellFrame]];
//reveal button
NSString * revealImageString;
@ -524,9 +521,7 @@
revealImageString = @"RevealOff.png";
NSImage * revealImage = [NSImage imageNamed: revealImageString];
[revealImage setFlipped: YES];
[revealImage drawInRect: [self revealButtonRectForBounds: cellFrame] fromRect: NSZeroRect operation: NSCompositeSourceOver
fraction: 1.0f];
[self drawImage: revealImage inRect: [self revealButtonRectForBounds: cellFrame]];
//action button
NSString * actionImageString;
@ -540,9 +535,7 @@
if (actionImageString)
{
NSImage * actionImage = [NSImage imageNamed: actionImageString];
[actionImage setFlipped: YES];
[actionImage drawInRect: [self actionButtonRectForBounds: cellFrame] fromRect: NSZeroRect operation: NSCompositeSourceOver
fraction: 1.0f];
[self drawImage: actionImage inRect: [self actionButtonRectForBounds: cellFrame]];
}
//status
@ -841,4 +834,15 @@
}
}
- (void) drawImage: (NSImage *) image inRect: (NSRect) rect
{
if ([NSApp isOnSnowLeopardOrBetter])
[image drawInRect: rect fromRect: NSZeroRect operation: NSCompositeSourceOver fraction: 1.0 respectFlipped: YES hints: nil];
else
{
[image setFlipped: YES];
[image drawInRect: rect fromRect: NSZeroRect operation: NSCompositeSourceOver fraction: 1.0];
}
}
@end