Move the pieces viewer into the Activity pane of Inspector.

This commit is contained in:
Mitchell Livingston
2006-09-25 20:53:10 +00:00
parent cb90fd21b6
commit a6a7be9daa
14 changed files with 41 additions and 83 deletions
+1 -1
View File
@@ -9,7 +9,7 @@
#import <Cocoa/Cocoa.h>
#import "Torrent.h"
@interface PiecesWindowController : NSWindowController
@interface PiecesView : NSObject
{
int8_t * fPieces;
+5 -16
View File
@@ -6,18 +6,18 @@
// Copyright 2006 __MyCompanyName__. All rights reserved.
//
#import "PiecesWindowController.h"
#import "PiecesView.h"
#define MAX_ACROSS 20
#define MAX_ACROSS 18
#define BETWEEN 1.0
#define BLANK -99
@implementation PiecesWindowController
@implementation PiecesView
- (id) initWithWindowNibName: (NSString *) name
- (id) init
{
if ((self = [super initWithWindowNibName: name]))
if ((self = [super init]))
{
fTorrent = nil;
int numPieces = MAX_ACROSS * MAX_ACROSS;
@@ -55,17 +55,6 @@
return self;
}
- (void) awakeFromNib
{
//window location and size
NSPanel * window = (NSPanel *)[self window];
[window setBecomesKeyOnlyIfNeeded: YES];
[window setFrameAutosaveName: @"PiecesWindowFrame"];
[window setFrameUsingName: @"PiecesWindowFrame"];
}
- (void) dealloc
{
free(fPieces);
+10 -22
View File
@@ -7,13 +7,12 @@
objects = {
/* Begin PBXBuildFile section */
3518E4A50AC620FC002ED3A2 /* PiecesWindowController.h in Headers */ = {isa = PBXBuildFile; fileRef = 3518E4A30AC620FC002ED3A2 /* PiecesWindowController.h */; };
3518E4A60AC620FC002ED3A2 /* PiecesWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3518E4A40AC620FC002ED3A2 /* PiecesWindowController.m */; };
3518E4A50AC620FC002ED3A2 /* PiecesView.h in Headers */ = {isa = PBXBuildFile; fileRef = 3518E4A30AC620FC002ED3A2 /* PiecesView.h */; };
3518E4A60AC620FC002ED3A2 /* PiecesView.m in Sources */ = {isa = PBXBuildFile; fileRef = 3518E4A40AC620FC002ED3A2 /* PiecesView.m */; };
3518E4D10AC62517002ED3A2 /* PiecesBack.tiff in CopyFiles */ = {isa = PBXBuildFile; fileRef = 3518E4CD0AC62517002ED3A2 /* PiecesBack.tiff */; };
3518E4D30AC62517002ED3A2 /* BoxBlue1.tiff in CopyFiles */ = {isa = PBXBuildFile; fileRef = 3518E4CF0AC62517002ED3A2 /* BoxBlue1.tiff */; };
3518E4D40AC62517002ED3A2 /* BoxBlue2.tiff in CopyFiles */ = {isa = PBXBuildFile; fileRef = 3518E4D00AC62517002ED3A2 /* BoxBlue2.tiff */; };
3518E4D70AC6253F002ED3A2 /* PiecesWindow.nib in Resources */ = {isa = PBXBuildFile; fileRef = 3518E4D50AC6253F002ED3A2 /* PiecesWindow.nib */; };
3518E4FB0AC62832002ED3A2 /* PiecesWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3518E4A40AC620FC002ED3A2 /* PiecesWindowController.m */; };
3518E4FB0AC62832002ED3A2 /* PiecesView.m in Sources */ = {isa = PBXBuildFile; fileRef = 3518E4A40AC620FC002ED3A2 /* PiecesView.m */; };
3518E5210AC62A29002ED3A2 /* PiecesBack.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 3518E4CD0AC62517002ED3A2 /* PiecesBack.tiff */; };
3518E5230AC62A2A002ED3A2 /* BoxBlue2.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 3518E4D00AC62517002ED3A2 /* BoxBlue2.tiff */; };
3518E5240AC62A2B002ED3A2 /* BoxBlue1.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 3518E4CF0AC62517002ED3A2 /* BoxBlue1.tiff */; };
@@ -249,12 +248,11 @@
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>"; };
32CA4F630368D1EE00C91783 /* Transmission_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Transmission_Prefix.pch; path = macosx/Transmission_Prefix.pch; sourceTree = "<group>"; };
3518E4A30AC620FC002ED3A2 /* PiecesWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PiecesWindowController.h; sourceTree = "<group>"; };
3518E4A40AC620FC002ED3A2 /* PiecesWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PiecesWindowController.m; sourceTree = "<group>"; };
3518E4A30AC620FC002ED3A2 /* PiecesView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PiecesView.h; sourceTree = "<group>"; };
3518E4A40AC620FC002ED3A2 /* PiecesView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PiecesView.m; sourceTree = "<group>"; };
3518E4CD0AC62517002ED3A2 /* PiecesBack.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = PiecesBack.tiff; path = macosx/Images/PiecesBack.tiff; sourceTree = "<group>"; };
3518E4CF0AC62517002ED3A2 /* BoxBlue1.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = BoxBlue1.tiff; path = macosx/Images/BoxBlue1.tiff; sourceTree = "<group>"; };
3518E4D00AC62517002ED3A2 /* BoxBlue2.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = BoxBlue2.tiff; path = macosx/Images/BoxBlue2.tiff; sourceTree = "<group>"; };
3518E4D60AC6253F002ED3A2 /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = macosx/English.lproj/PiecesWindow.nib; sourceTree = "<group>"; };
3518E5270AC62A55002ED3A2 /* BoxBlue3.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = BoxBlue3.tiff; path = macosx/Images/BoxBlue3.tiff; sourceTree = "<group>"; };
3518E5280AC62A55002ED3A2 /* BoxWhite.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = BoxWhite.tiff; path = macosx/Images/BoxWhite.tiff; sourceTree = "<group>"; };
3518E5760AC63262002ED3A2 /* BoxGreen.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = BoxGreen.tiff; path = macosx/Images/BoxGreen.tiff; sourceTree = "<group>"; };
@@ -452,8 +450,8 @@
080E96DDFE201D6D7F000001 /* Sources */ = {
isa = PBXGroup;
children = (
3518E4A30AC620FC002ED3A2 /* PiecesWindowController.h */,
3518E4A40AC620FC002ED3A2 /* PiecesWindowController.m */,
3518E4A30AC620FC002ED3A2 /* PiecesView.h */,
3518E4A40AC620FC002ED3A2 /* PiecesView.m */,
A2A306530AAD24A80049E2AC /* UKFileWatcher.h */,
A2A306540AAD24A80049E2AC /* UKFileWatcher.m */,
A2A306550AAD24A80049E2AC /* UKFNSubscribeFileWatcher.h */,
@@ -599,7 +597,6 @@
A253F7280A699373008EE24F /* FilterButtonSelectedMain.png */,
A253F7290A699373008EE24F /* FilterButtonSelectedRight.png */,
A2912C520A2956E80097A0CA /* PrefsWindow.nib */,
3518E4D50AC6253F002ED3A2 /* PiecesWindow.nib */,
);
name = Resources;
sourceTree = "<group>";
@@ -732,7 +729,7 @@
4DAB87C70ABE1F730081CF7E /* upnp.h in Headers */,
4DAB87C90ABE1F730081CF7E /* natpmp.h in Headers */,
4DAB87CB0ABE1F730081CF7E /* http.h in Headers */,
3518E4A50AC620FC002ED3A2 /* PiecesWindowController.h in Headers */,
3518E4A50AC620FC002ED3A2 /* PiecesView.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -886,7 +883,6 @@
35B037B60AC59C4000A10FDF /* Check.png in Resources */,
35B038130AC5B6EB00A10FDF /* ResumeNoWaitOn.png in Resources */,
35B038140AC5B6EC00A10FDF /* ResumeNoWaitOff.png in Resources */,
3518E4D70AC6253F002ED3A2 /* PiecesWindow.nib in Resources */,
3518E5210AC62A29002ED3A2 /* PiecesBack.tiff in Resources */,
3518E5230AC62A2A002ED3A2 /* BoxBlue2.tiff in Resources */,
3518E5240AC62A2B002ED3A2 /* BoxBlue1.tiff in Resources */,
@@ -922,7 +918,7 @@
4DAB87C80ABE1F730081CF7E /* upnp.c in Sources */,
4DAB87CA0ABE1F730081CF7E /* natpmp.c in Sources */,
4DAB87CC0ABE1F730081CF7E /* http.c in Sources */,
3518E4A60AC620FC002ED3A2 /* PiecesWindowController.m in Sources */,
3518E4A60AC620FC002ED3A2 /* PiecesView.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -957,7 +953,7 @@
A2A3065E0AAD24A80049E2AC /* UKFNSubscribeFileWatcher.m in Sources */,
A2A306600AAD24A80049E2AC /* UKKQueue.m in Sources */,
A2A306620AAD24A80049E2AC /* UKMainThreadProxy.m in Sources */,
3518E4FB0AC62832002ED3A2 /* PiecesWindowController.m in Sources */,
3518E4FB0AC62832002ED3A2 /* PiecesView.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -993,14 +989,6 @@
name = MainMenu.nib;
sourceTree = "<group>";
};
3518E4D50AC6253F002ED3A2 /* PiecesWindow.nib */ = {
isa = PBXVariantGroup;
children = (
3518E4D60AC6253F002ED3A2 /* English */,
);
name = PiecesWindow.nib;
sourceTree = "<group>";
};
A200B9620A227FD0007BBB1E /* InfoWindow.nib */ = {
isa = PBXVariantGroup;
children = (
-3
View File
@@ -30,7 +30,6 @@
#import "PrefsController.h"
#import "InfoWindowController.h"
#import "MessageWindowController.h"
#import "PiecesWindowController.h"
#import "Badger.h"
#import "ImageBackgroundView.h"
#import "BarButton.h"
@@ -50,7 +49,6 @@
NSUserDefaults * fDefaults;
InfoWindowController * fInfoController;
MessageWindowController * fMessageController;
PiecesWindowController * fPiecesWindowController;
IBOutlet NSWindow * fWindow;
IBOutlet NSScrollView * fScrollView;
@@ -141,7 +139,6 @@
- (void) setInfoTab: (id) sender;
- (void) showMessageWindow: (id) sender;
- (void) showPiecesView: (id) sender;
- (void) updateControlTint: (NSNotification *) notification;
+1 -36
View File
@@ -86,7 +86,6 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
fMessageController = [[MessageWindowController alloc] initWithWindowNibName: @"MessageWindow"];
fInfoController = [[InfoWindowController alloc] initWithWindowNibName: @"InfoWindow"];
fPiecesWindowController = [[PiecesWindowController alloc] initWithWindowNibName: @"PiecesWindow"];
fPrefsController = [[PrefsController alloc] initWithWindowNibName: @"PrefsWindow" handle: fLib];
fBadger = [[Badger alloc] init];
@@ -104,7 +103,6 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
[fInfoController release];
[fMessageController release];
[fPiecesWindowController release];
[fPrefsController release];
[fToolbar release];
@@ -359,9 +357,6 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
if ([fDefaults boolForKey: @"InfoVisible"])
[self showInfo: nil];
if ([fDefaults boolForKey: @"PiecesViewerVisible"])
[self showPiecesView: nil];
//timer to auto toggle speed limit
[self autoSpeedLimitChange: nil];
fSpeedLimitTimer = [NSTimer scheduledTimerWithTimeInterval: AUTO_SPEED_LIMIT_SECONDS target: self
@@ -428,7 +423,6 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
//remember window states and close all windows
[fDefaults setBool: [[fInfoController window] isVisible] forKey: @"InfoVisible"];
[fDefaults setBool: [[fPiecesWindowController window] isVisible] forKey: @"PiecesViewerVisible"];
[[NSApp windows] makeObjectsPerformSelector: @selector(close)];
[self showStatusBar: NO animate: NO];
[self showFilterBar: NO animate: NO];
@@ -936,17 +930,6 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
[fMessageController showWindow: nil];
}
- (void) showPiecesView: (id) sender
{
if ([[fPiecesWindowController window] isVisible])
[fPiecesWindowController close];
else
{
[fPiecesWindowController updateView: NO];
[[fPiecesWindowController window] orderFront: nil];
}
}
- (void) updateControlTint: (NSNotification *) notification
{
if (fSpeedLimitEnabled)
@@ -976,10 +959,6 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
//update non-constant parts of info window
if ([[fInfoController window] isVisible])
[fInfoController updateInfoStats];
//update pieces viewer
if ([[fPiecesWindowController window] isVisible])
[fPiecesWindowController updateView: NO];
//badge dock
[fBadger updateBadgeWithCompleted: fCompleted uploadRate: uploadRate downloadRate: downloadRate];
@@ -1727,11 +1706,7 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
- (void) tableViewSelectionDidChange: (NSNotification *) notification
{
NSArray * torrents = [self torrentsAtIndexes: [fTableView selectedRowIndexes]];
[fInfoController updateInfoForTorrents: torrents];
Torrent * torrent = [torrents count] == 1 ? [torrents objectAtIndex: 0] : nil;
[fPiecesWindowController setTorrent: torrent];
[fInfoController updateInfoForTorrents: [self torrentsAtIndexes: [fTableView selectedRowIndexes]]];
}
- (void) toggleSmallView: (id) sender
@@ -2076,16 +2051,6 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
return YES;
}
//enable show pieces window
if (action == @selector(showPiecesView:))
{
NSString * title = [[fPiecesWindowController window] isVisible] ? @"Hide Pieces Viewer" : @"Show Pieces Viewer";
if (![[menuItem title] isEqualToString: title])
[menuItem setTitle: title];
return YES;
}
//enable prev/next inspector tab
if (action == @selector(setInfoTab:))
return [[fInfoController window] isVisible];
-2
View File
@@ -54,8 +54,6 @@
<string>~/Desktop</string>
<key>NatTraversal</key>
<true/>
<key>PiecesViewerVisible</key>
<false/>
<key>PlayDownloadSound</key>
<true/>
<key>PlaySeedingSound</key>
+8 -1
View File
@@ -28,6 +28,7 @@
fPeerTable = NSTableView;
fPieceSizeField = NSTextField;
fPiecesField = NSTextField;
fPiecesView = PiecesView;
fRatioField = NSTextField;
fRatioLimitField = NSTextField;
fRatioMatrix = NSMatrix;
@@ -43,7 +44,13 @@
};
SUPERCLASS = NSWindowController;
},
{CLASS = NSSegmentedControl; LANGUAGE = ObjC; SUPERCLASS = NSControl; }
{CLASS = NSSegmentedControl; LANGUAGE = ObjC; SUPERCLASS = NSControl; },
{
CLASS = PiecesView;
LANGUAGE = ObjC;
OUTLETS = {fImageView = NSImageView; };
SUPERCLASS = NSObject;
}
);
IBVersion = 1;
}
Binary file not shown.
-1
View File
@@ -28,7 +28,6 @@
showInfo = id;
showMainWindow = id;
showMessageWindow = id;
showPiecesView = id;
showPreferenceWindow = id;
stopAllTorrents = id;
stopSelectedTorrents = id;
+1 -1
View File
@@ -31,8 +31,8 @@
<integer>3</integer>
<key>IBOpenObjects</key>
<array>
<integer>29</integer>
<integer>21</integer>
<integer>29</integer>
</array>
<key>IBSystem Version</key>
<string>8J135</string>
Binary file not shown.
Binary file not shown.
+3
View File
@@ -24,6 +24,7 @@
#import <Cocoa/Cocoa.h>
#import "Torrent.h"
#import "PiecesView.h"
#import <transmission.h>
@interface InfoWindowController : NSWindowController
@@ -52,6 +53,8 @@
IBOutlet NSMatrix * fRatioMatrix;
IBOutlet NSTextField * fRatioLimitField;
IBOutlet PiecesView * fPiecesView;
}
- (void) updateInfoForTorrents: (NSArray *) torrents;
+12
View File
@@ -169,6 +169,8 @@
[fPeers removeAllObjects];
[fPeerTable reloadData];
[fPiecesView setTorrent: nil];
}
else
{
@@ -205,6 +207,8 @@
[fHashField setSelectable: YES];
[fTorrentLocationField setSelectable: YES];
[fDataLocationField setSelectable: YES];
[fPiecesView setTorrent: torrent];
}
//update stats and settings
@@ -279,6 +283,10 @@
//set peers table if visible
if ([[[fTabView selectedTabViewItem] identifier] isEqualToString: TAB_PEERS_IDENT])
[self reloadPeerTable];
//update pieces view if visible
if ([[[fTabView selectedTabViewItem] identifier] isEqualToString: TAB_ACTIVITY_IDENT])
[fPiecesView updateView: NO];
}
}
@@ -384,7 +392,11 @@
{
float height;
if ([identifier isEqualToString: TAB_ACTIVITY_IDENT])
{
height = TAB_ACTIVITY_HEIGHT;
[fPiecesView updateView: NO];
}
else if ([identifier isEqualToString: TAB_PEERS_IDENT])
{
height = TAB_PEERS_HEIGHT;