Changeset 484 for trunk


Ignore:
Timestamp:
Jun 26, 2006, 5:52:51 AM (16 years ago)
Author:
livings124
Message:

Added an option to only show the remove/quit warning if transfers are downloading (not seeding). Also change the word "torrent" to "transfer" in the prefs window.

Location:
trunk/macosx
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/Controller.m

    r465 r484  
    259259    if (!fUpdateInProgress && [fDefaults boolForKey: @"CheckQuit"])
    260260    {
    261         int active = 0;
     261        int active = 0, downloading = 0;
    262262        Torrent * torrent;
    263263        NSEnumerator * enumerator = [fTorrents objectEnumerator];
    264264        while ((torrent = [enumerator nextObject]))
    265265            if ([torrent isActive])
     266            {
    266267                active++;
    267 
    268         if (active > 0)
     268                if (![torrent isSeeding])
     269                    downloading++;
     270            }
     271
     272        BOOL shouldAsk = [fDefaults boolForKey: @"CheckRemoveDownloading"] ? downloading > 0 : active > 0;
     273        if (shouldAsk)
    269274        {
    270275            NSString * message = active == 1
     
    517522{
    518523    NSArray * torrents = [[self torrentsAtIndexes: indexSet] retain];
    519     int active = 0;
    520 
    521     Torrent * torrent;
    522     NSEnumerator * enumerator = [torrents objectEnumerator];
    523     while ((torrent = [enumerator nextObject]))
    524         if ([torrent isActive])
    525             active++;
    526 
    527     if (active > 0 && [fDefaults boolForKey: @"CheckRemove"])
     524    int active = 0, downloading = 0;
     525
     526    if ([fDefaults boolForKey: @"CheckRemove"])
     527    {
     528        Torrent * torrent;
     529        NSEnumerator * enumerator = [torrents objectEnumerator];
     530        while ((torrent = [enumerator nextObject]))
     531            if ([torrent isActive])
     532            {
     533                active++;
     534                if (![torrent isSeeding])
     535                    downloading++;
     536            }
     537    }
     538
     539    BOOL shouldAsk = [fDefaults boolForKey: @"CheckRemoveDownloading"] ? downloading > 0 : active > 0;
     540    if (shouldAsk)
    528541    {
    529542        NSDictionary * dict = [[NSDictionary alloc] initWithObjectsAndKeys:
  • trunk/macosx/Defaults.plist

    r469 r484  
    1313        <key>CheckQuit</key>
    1414        <true/>
     15        <key>CheckQuitDownloading</key>
     16        <false/>
    1517        <key>CheckRemove</key>
    1618        <true/>
     19        <key>CheckRemoveDownloading</key>
     20        <false/>
    1721        <key>CheckUpload</key>
    1822        <true/>
     
    3034        <string>Info</string>
    3135        <key>InfoVisible</key>
    32         <false/>
    33         <key>Move</key>
    3436        <false/>
    3537        <key>MoveChoice</key>
  • trunk/macosx/English.lproj/PrefsWindow.nib/classes.nib

    r446 r484  
    3333                fPortField = NSTextField;
    3434                fQuitCheck = NSButton;
     35                fQuitDownloadingCheck = NSButton;
    3536                fRatioCheck = NSButton;
    3637                fRatioField = NSTextField;
    3738                fRemoveCheck = NSButton;
     39                fRemoveDownloadingCheck = NSButton;
    3840                fStartMatrix = NSMatrix;
    3941                fTransfersView = NSView;
  • trunk/macosx/English.lproj/PrefsWindow.nib/info.nib

    r459 r484  
    88        <dict>
    99                <key>28</key>
    10                 <string>308 472 535 212 0 0 1152 842 </string>
     10                <string>308 454 535 247 0 0 1152 842 </string>
    1111                <key>41</key>
    1212                <string>308 405 535 345 0 0 1152 842 </string>
     
    1818        <key>IBOpenObjects</key>
    1919        <array>
    20                 <integer>41</integer>
    2120                <integer>28</integer>
    2221        </array>
  • trunk/macosx/PrefsController.h

    r446 r484  
    3636    IBOutlet NSPopUpButton  * fFolderPopUp;
    3737    IBOutlet NSButton       * fQuitCheck, * fRemoveCheck,
     38                            * fQuitDownloadingCheck, * fRemoveDownloadingCheck,
    3839                            * fBadgeDownloadRateCheck, * fBadgeUploadRateCheck,
    3940                            * fCopyTorrentCheck, * fDeleteOriginalTorrentCheck;
  • trunk/macosx/PrefsController.m

    r483 r484  
    140140   
    141141    //set remove and quit prompts
    142     [fQuitCheck setState: [fDefaults boolForKey: @"CheckQuit"]];
    143     [fRemoveCheck setState: [fDefaults boolForKey: @"CheckRemove"]];
     142    BOOL isQuitCheck = [fDefaults boolForKey: @"CheckQuit"],
     143        isRemoveCheck = [fDefaults boolForKey: @"CheckRemove"];
     144   
     145    [fQuitCheck setState: isQuitCheck];
     146    [fRemoveCheck setState: isRemoveCheck];
     147   
     148    [fQuitDownloadingCheck setState: [fDefaults boolForKey: @"CheckQuitDownloading"]];
     149    [fQuitDownloadingCheck setEnabled: isQuitCheck];
     150    [fRemoveDownloadingCheck setState: [fDefaults boolForKey: @"CheckRemoveDownloading"]];
     151    [fRemoveDownloadingCheck setEnabled: isRemoveCheck];
    144152
    145153    //set dock badging
     
    383391- (void) setShowMessage: (id) sender
    384392{
     393    BOOL state = [sender state];
     394
    385395    if (sender == fQuitCheck)
    386         [fDefaults setBool: [sender state] forKey: @"CheckQuit"];
     396    {
     397        [fDefaults setBool: state forKey: @"CheckQuit"];
     398        [fQuitDownloadingCheck setEnabled: state];
     399    }
    387400    else if (sender == fRemoveCheck)
    388         [fDefaults setBool: [fRemoveCheck state] forKey: @"CheckRemove"];
     401    {
     402        [fDefaults setBool: state forKey: @"CheckRemove"];
     403        [fRemoveDownloadingCheck setEnabled: state];
     404    }
     405    if (sender == fQuitDownloadingCheck)
     406        [fDefaults setBool: state forKey: @"CheckQuitDownloading"];
     407    else if (sender == fRemoveDownloadingCheck)
     408        [fDefaults setBool: state forKey: @"CheckRemoveDownloading"];
    389409    else;
    390410}
Note: See TracChangeset for help on using the changeset viewer.