Changeset 956


Ignore:
Timestamp:
Sep 28, 2006, 9:14:49 PM (15 years ago)
Author:
livings124
Message:

Status on ports in prefs window. Thanks to cluthi on the forums for this.

Location:
trunk
Files:
3 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Transmission.xcodeproj/project.pbxproj

    r936 r956  
    138138                A291DAAF0AC8BEB6003385E9 /* PiecesView.m in Sources */ = {isa = PBXBuildFile; fileRef = A291DAAD0AC8BEB6003385E9 /* PiecesView.m */; };
    139139                A29597350A72A9E10057248B /* StatusBarBackground.png in Resources */ = {isa = PBXBuildFile; fileRef = A29597340A72A9E10057248B /* StatusBarBackground.png */; };
     140                A29C8B330ACC6E93000ED9F9 /* YellowDot.tiff in Resources */ = {isa = PBXBuildFile; fileRef = A29C8B320ACC6E93000ED9F9 /* YellowDot.tiff */; };
     141                A29C8B370ACC6EB3000ED9F9 /* PortChecker.m in Sources */ = {isa = PBXBuildFile; fileRef = A29C8B350ACC6EB3000ED9F9 /* PortChecker.m */; };
    140142                A2A3065C0AAD24A80049E2AC /* UKFileWatcher.m in Sources */ = {isa = PBXBuildFile; fileRef = A2A306540AAD24A80049E2AC /* UKFileWatcher.m */; };
    141143                A2A3065E0AAD24A80049E2AC /* UKFNSubscribeFileWatcher.m in Sources */ = {isa = PBXBuildFile; fileRef = A2A306560AAD24A80049E2AC /* UKFNSubscribeFileWatcher.m */; };
     
    362364                A291DAAD0AC8BEB6003385E9 /* PiecesView.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = PiecesView.m; path = macosx/PiecesView.m; sourceTree = "<group>"; };
    363365                A29597340A72A9E10057248B /* StatusBarBackground.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = StatusBarBackground.png; path = macosx/Images/StatusBarBackground.png; sourceTree = "<group>"; };
     366                A29C8B320ACC6E93000ED9F9 /* YellowDot.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = YellowDot.tiff; path = macosx/Images/YellowDot.tiff; sourceTree = "<group>"; };
     367                A29C8B340ACC6EB3000ED9F9 /* PortChecker.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = PortChecker.h; path = macosx/PortChecker.h; sourceTree = "<group>"; };
     368                A29C8B350ACC6EB3000ED9F9 /* PortChecker.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = PortChecker.m; path = macosx/PortChecker.m; sourceTree = "<group>"; };
    364369                A2A306530AAD24A80049E2AC /* UKFileWatcher.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = UKFileWatcher.h; path = macosx/UKKQueue/UKFileWatcher.h; sourceTree = "<group>"; };
    365370                A2A306540AAD24A80049E2AC /* UKFileWatcher.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = UKFileWatcher.m; path = macosx/UKKQueue/UKFileWatcher.m; sourceTree = "<group>"; };
     
    425430                                A2A306590AAD24A80049E2AC /* UKMainThreadProxy.h */,
    426431                                A2A3065A0AAD24A80049E2AC /* UKMainThreadProxy.m */,
     432                                A29C8B340ACC6EB3000ED9F9 /* PortChecker.h */,
     433                                A29C8B350ACC6EB3000ED9F9 /* PortChecker.m */,
    427434                                A291DAAC0AC8BEB6003385E9 /* PiecesView.h */,
    428435                                A291DAAD0AC8BEB6003385E9 /* PiecesView.m */,
     
    501508                                35B037A60AC59BC600A10FDF /* Check.png */,
    502509                                A260C9AB0AA3B8D700FDC1B7 /* Error.tiff */,
     510                                A29C8B320ACC6E93000ED9F9 /* YellowDot.tiff */,
    503511                                A2D4F0840A915F7200890C32 /* GreenDot.tiff */,
    504512                                A2D4F0820A915F6600890C32 /* RedDot.tiff */,
     
    843851                                35B038130AC5B6EB00A10FDF /* ResumeNoWaitOn.png in Resources */,
    844852                                35B038140AC5B6EC00A10FDF /* ResumeNoWaitOff.png in Resources */,
     853                                A29C8B330ACC6E93000ED9F9 /* YellowDot.tiff in Resources */,
    845854                        );
    846855                        runOnlyForDeploymentPostprocessing = 0;
     
    907916                                A2A306620AAD24A80049E2AC /* UKMainThreadProxy.m in Sources */,
    908917                                A291DAAF0AC8BEB6003385E9 /* PiecesView.m in Sources */,
     918                                A29C8B370ACC6EB3000ED9F9 /* PortChecker.m in Sources */,
    909919                        );
    910920                        runOnlyForDeploymentPostprocessing = 0;
  • trunk/macosx/English.lproj/PrefsWindow.nib/classes.nib

    r920 r956  
    5454                fPlaySeedingSoundCheck = NSButton;
    5555                fPortField = NSTextField;
     56                fPortStatusField = NSTextField;
     57                fPortStatusImage = NSImageView;
     58                fPortStatusProgress = NSProgressIndicator;
    5659                fQueueCheck = NSButton;
    5760                fQueueNumberField = NSTextField;
  • trunk/macosx/English.lproj/PrefsWindow.nib/info.nib

    r920 r956  
    44<dict>
    55        <key>IBDocumentLocation</key>
    6         <string>15 73 356 240 0 0 1024 746 </string>
     6        <string>18 87 356 240 0 0 1152 842 </string>
    77        <key>IBEditorPositions</key>
    88        <dict>
     
    1212                <string>22 331 577 290 0 0 1024 746 </string>
    1313                <key>41</key>
    14                 <string>230 355 563 317 0 0 1024 746 </string>
     14                <string>294 420 563 317 0 0 1152 842 </string>
    1515                <key>66</key>
    16                 <string>29 426 563 159 0 0 1024 746 </string>
     16                <string>72 601 563 159 0 0 1152 842 </string>
    1717        </dict>
    1818        <key>IBFramework Version</key>
     
    2424        <key>IBOpenObjects</key>
    2525        <array>
     26                <integer>66</integer>
    2627                <integer>41</integer>
    2728        </array>
  • trunk/macosx/PiecesView.m

    r954 r956  
    214214                point = NSMakePoint(j * (fWidth + BETWEEN) + BETWEEN + fExtraBorder,
    215215                                    [[fImageView image] size].width - (i + 1) * (fWidth + BETWEEN) - fExtraBorder);
    216                
    217216                [pieceImage compositeToPoint: point fromRect: rect operation: NSCompositeSourceOver];
    218217            }
  • trunk/macosx/PrefsController.h

    r920 r956  
    2626#import <transmission.h>
    2727#import <Sparkle/Sparkle.h>
     28#import "PortChecker.h"
    2829
    2930@interface PrefsController : NSWindowController
     
    5152                            * fSpeedLimitAutoCheck;
    5253
    53     IBOutlet NSTextField    * fPortField, * fNatStatusField;
     54    IBOutlet NSTextField    * fPortField, * fNatStatusField, * fPortStatusField;
    5455    IBOutlet NSButton       * fNatCheck;
    55     IBOutlet NSImageView    * fNatStatusImage;
     56    IBOutlet NSImageView    * fNatStatusImage, * fPortStatusImage;
     57    IBOutlet NSProgressIndicator * fPortStatusProgress;
    5658    NSTimer                 * fNatStatusTimer;
    5759    int                     fNatStatus;
     
    8890
    8991- (void) setPort:   (id) sender;
     92- (void) updatePortStatus;
     93- (void) portCheckerDidFinishProbing: (PortChecker *) portChecker;
    9094- (void) setNat:    (id) sender;
    9195- (void) updateNatStatus;
  • trunk/macosx/PrefsController.m

    r933 r956  
    124124    [fPortField setIntValue: bindPort];
    125125    tr_setBindPort(fHandle, bindPort);
     126    [self updatePortStatus];
    126127   
    127128    //set NAT
     
    360361       
    361362        [self updateNatStatus];
    362     }
     363        [self updatePortStatus];
     364    }
     365}
     366
     367- (void) updatePortStatus
     368{
     369    long sytemVersion;
     370    [fPortStatusField setStringValue: @""];
     371    [fPortStatusImage setImage: nil];
     372   
     373    Gestalt('sysv', & sytemVersion);
     374    if (sytemVersion >= 0x1040)
     375    {
     376        //NSXML features are unfortunately only available since Mac OS X v10.4
     377        PortChecker * checker = [[PortChecker alloc] initWithDelegate: self];
     378
     379        [fPortStatusField setStringValue: [@"Checking port status" stringByAppendingEllipsis]];
     380        [fPortStatusProgress startAnimation: self];
     381       
     382        [checker probePort: [fDefaults integerForKey: @"BindPort"]];
     383    }
     384}
     385
     386- (void) portCheckerDidFinishProbing: (PortChecker *) portChecker
     387{
     388    [fPortStatusProgress stopAnimation: self];
     389    switch ([portChecker status])
     390    {
     391        case PORT_STATUS_OPEN:
     392            [fPortStatusField setStringValue: @"Port is open"];
     393            [fPortStatusImage setImage: [NSImage imageNamed: @"GreenDot.tiff"]];
     394            break;
     395        case PORT_STATUS_STEALTH:
     396            [fPortStatusField setStringValue: @"Port is stealth"];
     397            [fPortStatusImage setImage: [NSImage imageNamed: @"RedDot.tiff"]];
     398            break;
     399        case PORT_STATUS_CLOSED:
     400            [fPortStatusField setStringValue: @"Port is closed"];
     401            [fPortStatusImage setImage: [NSImage imageNamed: @"RedDot.tiff"]];
     402            break;
     403        case PORT_STATUS_ERROR:
     404            [fPortStatusField setStringValue: @"Unable to check port status"];
     405            [fPortStatusImage setImage: [NSImage imageNamed: @"YellowDot.tiff"]];
     406            break;
     407    }
     408    [portChecker release];
    363409}
    364410
Note: See TracChangeset for help on using the changeset viewer.