Changeset 4081


Ignore:
Timestamp:
Dec 6, 2007, 5:21:42 PM (14 years ago)
Author:
livings124
Message:

group together pause and resume toolbar buttons

Location:
trunk
Files:
2 added
4 edited

Legend:

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

    r4074 r4081  
    7474                A21567ED0A9A5034004DECD6 /* MessageWindow.nib in Resources */ = {isa = PBXBuildFile; fileRef = A21567EB0A9A5034004DECD6 /* MessageWindow.nib */; };
    7575                A215760B0C0D449A0057A26A /* NSBezierPathAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = A21576090C0D449A0057A26A /* NSBezierPathAdditions.m */; };
     76                A219798B0D07B78400438EA7 /* ButtonGroupToolbarItem.m in Sources */ = {isa = PBXBuildFile; fileRef = A219798A0D07B78400438EA7 /* ButtonGroupToolbarItem.m */; };
    7677                A21DFF100A292B2B007C5F76 /* Transfers.png in Resources */ = {isa = PBXBuildFile; fileRef = A21DFF0F0A292B2B007C5F76 /* Transfers.png */; };
    7778                A21F5B890AF25FB6008CE5CE /* ActionMenuRatioToDisplayRatioTransformer.m in Sources */ = {isa = PBXBuildFile; fileRef = A21F5B870AF25FB6008CE5CE /* ActionMenuRatioToDisplayRatioTransformer.m */; };
     
    407408                A21576090C0D449A0057A26A /* NSBezierPathAdditions.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = NSBezierPathAdditions.m; path = macosx/NSBezierPathAdditions.m; sourceTree = "<group>"; };
    408409                A215760A0C0D449A0057A26A /* NSBezierPathAdditions.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = NSBezierPathAdditions.h; path = macosx/NSBezierPathAdditions.h; sourceTree = "<group>"; };
     410                A21979890D07B78400438EA7 /* ButtonGroupToolbarItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ButtonGroupToolbarItem.h; path = macosx/ButtonGroupToolbarItem.h; sourceTree = "<group>"; };
     411                A219798A0D07B78400438EA7 /* ButtonGroupToolbarItem.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ButtonGroupToolbarItem.m; path = macosx/ButtonGroupToolbarItem.m; sourceTree = "<group>"; };
    409412                A21DFF0F0A292B2B007C5F76 /* Transfers.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Transfers.png; path = macosx/Images/Transfers.png; sourceTree = "<group>"; };
    410413                A21F5B860AF25FB6008CE5CE /* ActionMenuRatioToDisplayRatioTransformer.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = ActionMenuRatioToDisplayRatioTransformer.h; path = macosx/ActionMenuRatioToDisplayRatioTransformer.h; sourceTree = "<group>"; };
     
    781784                                A2C89D5F0CFCBF57004CC2BC /* ButtonToolbarItem.m */,
    782785                                A28E1DDF0CFFD8EC00E16385 /* ButtonToolbarItem.h */,
     786                                A21979890D07B78400438EA7 /* ButtonGroupToolbarItem.h */,
     787                                A219798A0D07B78400438EA7 /* ButtonGroupToolbarItem.m */,
    783788                                A257C17F0CAD3003004E121C /* PeerTableView.h */,
    784789                                A257C1800CAD3003004E121C /* PeerTableView.m */,
     
    16341639                                A28E1DBA0CFFD41800E16385 /* BottomBarView.m in Sources */,
    16351640                                A28E1E160D00574A00E16385 /* ActionPopUpButton.m in Sources */,
     1641                                A219798B0D07B78400438EA7 /* ButtonGroupToolbarItem.m in Sources */,
    16361642                        );
    16371643                        runOnlyForDeploymentPostprocessing = 0;
  • trunk/macosx/Controller.h

    r4063 r4081  
    214214- (void) showFilterBar: (BOOL) show animate: (BOOL) animate;
    215215
     216- (void) selectedToolbarClicked: (id) sender;
     217
    216218- (void) doNothing: (id) sender; //needed for menu items that use bindings with no associated action
    217219
  • trunk/macosx/Controller.m

    r4072 r4081  
    3333#import "AboutWindowController.h"
    3434#import "ButtonToolbarItem.h"
     35#import "ButtonGroupToolbarItem.h"
    3536#import "NSApplicationAdditions.h"
    3637#import "NSStringAdditions.h"
     
    4445#import <Sparkle/Sparkle.h>
    4546
    46 #define TOOLBAR_CREATE          @"Toolbar Create"
    47 #define TOOLBAR_OPEN            @"Toolbar Open"
    48 #define TOOLBAR_REMOVE          @"Toolbar Remove"
    49 #define TOOLBAR_INFO            @"Toolbar Info"
    50 #define TOOLBAR_PAUSE_ALL       @"Toolbar Pause All"
    51 #define TOOLBAR_RESUME_ALL      @"Toolbar Resume All"
    52 #define TOOLBAR_PAUSE_SELECTED  @"Toolbar Pause Selected"
    53 #define TOOLBAR_RESUME_SELECTED @"Toolbar Resume Selected"
    54 #define TOOLBAR_FILTER          @"Toolbar Toggle Filter"
     47#define TOOLBAR_CREATE                  @"Toolbar Create"
     48#define TOOLBAR_OPEN                    @"Toolbar Open"
     49#define TOOLBAR_REMOVE                  @"Toolbar Remove"
     50#define TOOLBAR_INFO                    @"Toolbar Info"
     51#define TOOLBAR_PAUSE_ALL               @"Toolbar Pause All"
     52#define TOOLBAR_RESUME_ALL              @"Toolbar Resume All"
     53#define TOOLBAR_PAUSE_RESUME_ALL        @"Toolbar Pause / Resume All"
     54#define TOOLBAR_PAUSE_SELECTED          @"Toolbar Pause Selected"
     55#define TOOLBAR_RESUME_SELECTED         @"Toolbar Resume Selected"
     56#define TOOLBAR_PAUSE_RESUME_SELECTED   @"Toolbar Pause / Resume Selected"
     57#define TOOLBAR_FILTER                  @"Toolbar Toggle Filter"
    5558
    5659#define SORT_DATE       @"Date"
     
    215218- (void) awakeFromNib
    216219{
    217     NSToolbar * toolbar = [[NSToolbar alloc] initWithIdentifier: @"Transmission Toolbar"];
     220    NSToolbar * toolbar = [[NSToolbar alloc] initWithIdentifier: @"TRMainToolbar"];
    218221    [toolbar setDelegate: self];
    219222    [toolbar setAllowsUserCustomization: YES];
     
    26382641- (NSToolbarItem *) toolbar: (NSToolbar *) toolbar itemForItemIdentifier: (NSString *) ident willBeInsertedIntoToolbar: (BOOL) flag
    26392642{
    2640     ButtonToolbarItem * item = [[ButtonToolbarItem alloc] initWithItemIdentifier: ident];
     2643    ButtonToolbarItem * item = [[[ButtonToolbarItem alloc] initWithItemIdentifier: ident] autorelease];
    26412644   
    26422645    NSButton * button = [[NSButton alloc] initWithFrame: NSZeroRect];
     
    27082711        [item setAction: @selector(resumeAllTorrents:)];
    27092712    }
    2710     else if ([ident isEqualToString: TOOLBAR_PAUSE_SELECTED])
    2711     {
    2712         [item setLabel: NSLocalizedString(@"Pause", "Pause toolbar item -> label")];
    2713         [item setPaletteLabel: NSLocalizedString(@"Pause Selected", "Pause toolbar item -> palette label")];
    2714         [item setToolTip: NSLocalizedString(@"Pause selected transfers", "Pause toolbar item -> tooltip")];
    2715         [item setImage: [NSImage imageNamed: @"PauseSelected.png"]];
    2716         [item setTarget: self];
    2717         [item setAction: @selector(stopSelectedTorrents:)];
    2718     }
    2719     else if ([ident isEqualToString: TOOLBAR_RESUME_SELECTED])
    2720     {
    2721         [item setLabel: NSLocalizedString(@"Resume", "Resume toolbar item -> label")];
    2722         [item setPaletteLabel: NSLocalizedString(@"Resume Selected", "Resume toolbar item -> palette label")];
    2723         [item setToolTip: NSLocalizedString(@"Resume selected transfers", "Resume toolbar item -> tooltip")];
    2724         [item setImage: [NSImage imageNamed: @"ResumeSelected.png"]];
    2725         [item setTarget: self];
    2726         [item setAction: @selector(resumeSelectedTorrents:)];
     2713    else if ([ident isEqualToString: TOOLBAR_PAUSE_RESUME_ALL])
     2714    {
     2715        ButtonGroupToolbarItem * groupItem = [[[ButtonGroupToolbarItem alloc] initWithItemIdentifier: ident] autorelease];
     2716       
     2717        NSSegmentedControl * segmentedControl = [[NSSegmentedControl alloc] initWithFrame: NSZeroRect];
     2718        [groupItem setView: segmentedControl];
     2719       
     2720        [segmentedControl setSegmentCount: 2];
     2721        [(NSSegmentedCell *)[segmentedControl cell] setTrackingMode: NSSegmentSwitchTrackingMomentary];
     2722       
     2723        NSSize groupSize = NSMakeSize(72.0, 25.0);
     2724        [groupItem setMinSize: groupSize];
     2725        [groupItem setMaxSize: groupSize];
     2726       
     2727        [groupItem setLabel: NSLocalizedString(@"Apply All", "All toolbar item -> label")];
     2728        [groupItem setPaletteLabel: NSLocalizedString(@"Pause / Resume All", "All toolbar item -> palette label")];
     2729        [groupItem setTarget: self];
     2730        [groupItem setAction: @selector(allToolbarClicked:)];
     2731       
     2732        [groupItem setIdentifiers: [NSArray arrayWithObjects: TOOLBAR_PAUSE_ALL, TOOLBAR_RESUME_ALL, nil]];
     2733       
     2734        [segmentedControl setImage: [NSImage imageNamed: @"PauseAll.png"] forSegment: 0];
     2735        [(NSSegmentedCell *)[segmentedControl cell] setToolTip: NSLocalizedString(@"Pause all transfers",
     2736                                                        "All toolbar item -> tooltip") forSegment: 0];
     2737       
     2738        [segmentedControl setImage: [NSImage imageNamed: @"ResumeAll.png"] forSegment: 1];
     2739        [(NSSegmentedCell *)[segmentedControl cell] setToolTip: NSLocalizedString(@"Resume all transfers",
     2740                                                        "All toolbar item -> tooltip") forSegment: 1];
     2741       
     2742        [segmentedControl release];
     2743        return groupItem;
     2744    }
     2745
     2746    else if ([ident isEqualToString: TOOLBAR_PAUSE_RESUME_SELECTED])
     2747    {
     2748        ButtonGroupToolbarItem * groupItem = [[[ButtonGroupToolbarItem alloc] initWithItemIdentifier: ident] autorelease];
     2749       
     2750        NSSegmentedControl * segmentedControl = [[NSSegmentedControl alloc] initWithFrame: NSZeroRect];
     2751        [groupItem setView: segmentedControl];
     2752       
     2753        [segmentedControl setSegmentCount: 2];
     2754        [(NSSegmentedCell *)[segmentedControl cell] setTrackingMode: NSSegmentSwitchTrackingMomentary];
     2755       
     2756        NSSize groupSize = NSMakeSize(72.0, 25.0);
     2757        [groupItem setMinSize: groupSize];
     2758        [groupItem setMaxSize: groupSize];
     2759       
     2760        [groupItem setLabel: NSLocalizedString(@"Apply Selected", "Selected toolbar item -> label")];
     2761        [groupItem setPaletteLabel: NSLocalizedString(@"Pause / Resume Selected", "Selected toolbar item -> palette label")];
     2762        [groupItem setTarget: self];
     2763        [groupItem setAction: @selector(selectedToolbarClicked:)];
     2764       
     2765        [groupItem setIdentifiers: [NSArray arrayWithObjects: TOOLBAR_PAUSE_SELECTED, TOOLBAR_RESUME_SELECTED, nil]];
     2766       
     2767        [segmentedControl setImage: [NSImage imageNamed: @"PauseSelected.png"] forSegment: 0];
     2768        [(NSSegmentedCell *)[segmentedControl cell] setToolTip: NSLocalizedString(@"Pause selected transfers",
     2769                                                        "Selected toolbar item -> tooltip") forSegment: 0];
     2770       
     2771        [segmentedControl setImage: [NSImage imageNamed: @"ResumeSelected.png"] forSegment: 1];
     2772        [(NSSegmentedCell *)[segmentedControl cell] setToolTip: NSLocalizedString(@"Resume selected transfers",
     2773                                                        "Selected toolbar item -> tooltip") forSegment: 1];
     2774       
     2775        [segmentedControl release];
     2776        return groupItem;
    27272777    }
    27282778    else if ([ident isEqualToString: TOOLBAR_FILTER])
     
    27372787    }
    27382788    else
    2739     {
    2740         [item release];
    27412789        return nil;
    2742     }
    2743 
    2744     return [item autorelease];
     2790
     2791    return item;
     2792}
     2793
     2794#warning use constants
     2795- (void) allToolbarClicked: (id) sender
     2796{
     2797    if ([sender selectedSegment] == 0)
     2798        [self stopAllTorrents: sender];
     2799    else if ([sender selectedSegment] == 1)
     2800        [self resumeAllTorrents: sender];
     2801    else;
     2802}
     2803
     2804#warning use constants
     2805- (void) selectedToolbarClicked: (id) sender
     2806{
     2807    if ([sender selectedSegment] == 0)
     2808        [self stopSelectedTorrents: sender];
     2809    else if ([sender selectedSegment] == 1)
     2810        [self resumeSelectedTorrents: sender];
     2811    else;
    27452812}
    27462813
     
    27492816    return [NSArray arrayWithObjects:
    27502817            TOOLBAR_CREATE, TOOLBAR_OPEN, TOOLBAR_REMOVE,
    2751             TOOLBAR_PAUSE_SELECTED, TOOLBAR_RESUME_SELECTED,
    2752             TOOLBAR_PAUSE_ALL, TOOLBAR_RESUME_ALL, TOOLBAR_FILTER, TOOLBAR_INFO,
     2818            TOOLBAR_PAUSE_RESUME_SELECTED, TOOLBAR_PAUSE_RESUME_ALL,
     2819            TOOLBAR_FILTER, TOOLBAR_INFO,
    27532820            NSToolbarSeparatorItemIdentifier,
    27542821            NSToolbarSpaceItemIdentifier,
     
    27622829            TOOLBAR_CREATE, TOOLBAR_OPEN, TOOLBAR_REMOVE,
    27632830            NSToolbarSeparatorItemIdentifier,
    2764             TOOLBAR_PAUSE_ALL, TOOLBAR_RESUME_ALL,
     2831            TOOLBAR_PAUSE_RESUME_ALL,
    27652832            NSToolbarFlexibleSpaceItemIdentifier,
    27662833            TOOLBAR_FILTER, TOOLBAR_INFO, nil];
     
    27702837{
    27712838    NSString * ident = [toolbarItem itemIdentifier];
    2772 
     2839   
    27732840    //enable remove item
    27742841    if ([ident isEqualToString: TOOLBAR_REMOVE])
  • trunk/macosx/English.lproj/Localizable.strings

    r3996 r4081  
    5757
    5858/* Torrent -> remaining time */
    59 "%d days %d hr" = "%1$d days %2$d hr";
     59"%d days %02d hr" = "%1$d days %2$d hr";
    6060
    6161/* Dock item - Downloading */
     
    7474
    7575/* Torrent -> remaining time */
    76 "%d hr %d min" = "%1$d hr %2$d min";
     76"%d hr %02d min" = "%1$d hr %2$d min";
    7777
    7878/* Inspector -> Peers tab -> peers */
     
    8383
    8484/* Torrent -> remaining time */
    85 "%d min %d sec" = "%1$d min %2$d sec";
     85"%d min %02d sec" = "%1$d min %2$d sec";
    8686
    8787/* Inspector -> Peers tab -> peers */
     
    109109"%d tracker" = "%d tracker";
    110110
    111 /* Filter Bar Button -> tool tip
    112    Status bar transfer count */
     111/* Status bar transfer count */
     112"%d transfers" = "%d transfers";
     113
     114/* Filter Bar Button -> tool tip */
    113115"%d Transfers" = "%d Transfers";
    114116
     
    127129
    128130/* Torrent -> remaining time */
    129 "1 day %d hr" = "1 day %d hr";
     131"1 day %02d hr" = "1 day %02d hr";
    130132
    131133/* Drag overlay -> torrents
     
    140142"1 time" = "1 time";
    141143
    142 /* Filter Button -> tool tip
    143    Status bar transfer count */
     144/* Filter Button -> tool tip */
    144145"1 Transfer" = "1 Transfer";
     146
     147/* Status bar transfer count */
     148"1 transfer" = "1 transfer";
    145149
    146150/* Move folder cannot be used alert -> message */
     
    164168/* Open duplicate alert -> title */
    165169"A transfer of \"%@\" is already running." = "A transfer of \"%@\" is already running.";
    166 
    167 /* peer -> status */
    168 "Active" = "Active";
    169 
    170 /* peer -> status */
    171 "Active & Interested" = "Active & Interested";
    172170
    173171/* Inspector -> title */
     
    206204"Checking port status" = "Checking port status";
    207205
    208 /* peer -> status */
    209 "Choked" = "Choked";
    210 
    211 /* peer -> status */
    212 "Choked & Interested" = "Choked & Interested";
    213 
    214206/* Folder cannot be used alert -> location button */
    215207"Choose New Location" = "Choose New Location";
     
    261253"Creation of \"%@\" failed." = "Creation of \"%@\" failed.";
    262254
     255/* status bar -> status label (3 spaces between) */
     256"DL: %@   UL: %@" = "DL: %1$@   UL: %2$@";
     257
    263258/* Torrent -> status string */
    264259"DL: %@, UL: %@" = "DL: %1$@, UL: %2$@";
     
    292287"Downloading from %d of 1 peer" = "Downloading from %d of 1 peer";
    293288
     289/* Inspector -> peer -> status */
     290"Downloading from peer" = "Downloading from peer";
     291
    294292/* inspector -> peer table -> header tool tip */
    295293"Downloading From Peer" = "Downloading From Peer";
     
    299297"Encrypted Connection" = "Encrypted Connection";
    300298
     299/* Torrent -> status string */
     300"Error" = "Error";
     301
    301302/* Ratio invalid
    302303   Transfer speed invalid */
     
    304305
    305306/* Torrent -> status string */
    306 "Error" = "Error";
    307 
    308 /* Torrent -> status string */
    309307"Error: " = "Error: ";
    310308
     
    336334"General Info" = "General Info";
    337335
    338 /* peer -> status */
     336/* Inspector -> peer -> status */
    339337"Handshaking" = "Handshaking";
    340338
     
    417415"Open" = "Open";
    418416
     417/* Open toolbar item -> tooltip */
     418"Open torrent files" = "Open torrent files";
     419
    419420/* Open toolbar item -> palette label */
    420421"Open Torrent Files" = "Open Torrent Files";
    421422
    422 /* Open toolbar item -> tooltip */
    423 "Open torrent files" = "Open torrent files";
    424 
    425423/* Inspector -> title */
    426424"Options" = "Options";
     
    441439"Pause selected transfers" = "Pause selected transfers";
    442440
     441/* Torrent Table -> tooltip */
     442"Pause the transfer." = "Pause the transfer.";
     443
    443444/* Torrent -> status string */
    444445"Paused" = "Paused";
    445446
    446 /* peer -> status */
    447 "Peer is Choked" = "Peer is Choked";
     447/* Inspector -> peer -> status */
     448"Peer wants our data" = "Peer wants our data";
     449
     450/* Inspector -> peer -> status */
     451"Peer will not send us data" = "Peer will not send us data";
    448452
    449453/* Inspector -> title */
     
    487491"Quit" = "Quit";
    488492
    489 /* Torrent -> status string */
     493/* Torrent -> status string
     494   status bar -> status label */
    490495"Ratio: " = "Ratio: ";
    491496
     
    493498"Ratio: %@, UL: %@" = "Ratio: %1$@, UL: %2$@";
    494499
    495 /* peer -> status */
    496 "Ready" = "Ready";
     500/* Inspector -> peer -> status */
     501"Refusing to send data to peer" = "Refusing to send data to peer";
    497502
    498503/* Removal confirm panel -> button
     
    506511"Remove selected transfers" = "Remove selected transfers";
    507512
    508 /* peer -> status */
    509 "Request Sent" = "Request Sent";
     513/* Inspector -> peer -> status */
     514"Requesting data from peer" = "Requesting data from peer";
    510515
    511516/* Resume toolbar item -> label */
     
    523528/* Resume toolbar item -> tooltip */
    524529"Resume selected transfers" = "Resume selected transfers";
     530
     531/* Torrent Table -> tooltip */
     532"Resume the transfer right away." = "Resume the transfer right away.";
     533
     534/* Torrent Table -> tooltip */
     535"Resume the transfer." = "Resume the transfer.";
     536
     537/* Torrent Table -> tooltip */
     538"Reveal the data file in Finder." = "Reveal the data file in Finder.";
    525539
    526540/* Torrent -> status string */
     
    564578"Select the new folder for \"%@\"." = "Select the new folder for \"%@\".";
    565579
     580/* Torrent Table -> tooltip */
     581"Shortcut for changing transfer settings." = "Shortcut for changing transfer settings.";
     582
    566583/* Main window -> 1st bottom left button (action) tooltip */
    567584"Shortcuts for changing global settings." = "Shortcuts for changing global settings.";
     
    592609"Stop at Ratio (%.2f)" = "Stop at Ratio (%.2f)";
    593610
     611/* Torrent Table -> tooltip */
     612"Stop waiting to start." = "Stop waiting to start.";
     613
    594614/* File size */
    595615"TB" = "TB";
     
    687707"Torrent Inspector" = "Torrent Inspector";
    688708
    689 /* Status bar -> total download */
    690 "Total DL: " = "Total DL: ";
     709/* Status Bar -> speed tooltip */
     710"Total download speed" = "Total download speed";
    691711
    692712/* stats total */
    693713"Total N/A" = "Total N/A";
    694714
    695 /* Status bar -> total upload */
    696 "Total UL: " = "Total UL: ";
     715/* Status Bar -> speed tooltip */
     716"Total upload speed" = "Total upload speed";
    697717
    698718/* Preferences -> Transfers toolbar item title */
     
    717737"Uploading To Peer" = "Uploading To Peer";
    718738
     739/* Inspector -> peer -> status */
     740"Uploading to peer" = "Uploading to peer";
     741
    719742/* Torrent -> status string */
    720743"Waiting to check existing data" = "Waiting to check existing data";
     
    722745/* Torrent -> status string */
    723746"Waiting to download" = "Waiting to download";
     747
     748/* Inspector -> peer -> status */
     749"Waiting to request data from peer" = "Waiting to request data from peer";
    724750
    725751/* Torrent -> status string */
Note: See TracChangeset for help on using the changeset viewer.