mirror of
https://github.com/transmission/transmission
synced 2024-12-24 08:43:27 +00:00
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.
This commit is contained in:
parent
5046cc4752
commit
72eecfa7d4
7 changed files with 54 additions and 17 deletions
|
@ -258,14 +258,19 @@ static void sleepCallBack(void * controller, io_service_t y,
|
|||
{
|
||||
if (!fUpdateInProgress && [fDefaults boolForKey: @"CheckQuit"])
|
||||
{
|
||||
int active = 0;
|
||||
int active = 0, downloading = 0;
|
||||
Torrent * torrent;
|
||||
NSEnumerator * enumerator = [fTorrents objectEnumerator];
|
||||
while ((torrent = [enumerator nextObject]))
|
||||
if ([torrent isActive])
|
||||
{
|
||||
active++;
|
||||
if (![torrent isSeeding])
|
||||
downloading++;
|
||||
}
|
||||
|
||||
if (active > 0)
|
||||
BOOL shouldAsk = [fDefaults boolForKey: @"CheckRemoveDownloading"] ? downloading > 0 : active > 0;
|
||||
if (shouldAsk)
|
||||
{
|
||||
NSString * message = active == 1
|
||||
? @"There is an active transfer. Do you really want to quit?"
|
||||
|
@ -516,15 +521,23 @@ static void sleepCallBack(void * controller, io_service_t y,
|
|||
deleteData: (BOOL) deleteData deleteTorrent: (BOOL) deleteTorrent
|
||||
{
|
||||
NSArray * torrents = [[self torrentsAtIndexes: indexSet] retain];
|
||||
int active = 0;
|
||||
int active = 0, downloading = 0;
|
||||
|
||||
Torrent * torrent;
|
||||
NSEnumerator * enumerator = [torrents objectEnumerator];
|
||||
while ((torrent = [enumerator nextObject]))
|
||||
if ([torrent isActive])
|
||||
active++;
|
||||
if ([fDefaults boolForKey: @"CheckRemove"])
|
||||
{
|
||||
Torrent * torrent;
|
||||
NSEnumerator * enumerator = [torrents objectEnumerator];
|
||||
while ((torrent = [enumerator nextObject]))
|
||||
if ([torrent isActive])
|
||||
{
|
||||
active++;
|
||||
if (![torrent isSeeding])
|
||||
downloading++;
|
||||
}
|
||||
}
|
||||
|
||||
if (active > 0 && [fDefaults boolForKey: @"CheckRemove"])
|
||||
BOOL shouldAsk = [fDefaults boolForKey: @"CheckRemoveDownloading"] ? downloading > 0 : active > 0;
|
||||
if (shouldAsk)
|
||||
{
|
||||
NSDictionary * dict = [[NSDictionary alloc] initWithObjectsAndKeys:
|
||||
torrents, @"Torrents",
|
||||
|
|
|
@ -12,8 +12,12 @@
|
|||
<false/>
|
||||
<key>CheckQuit</key>
|
||||
<true/>
|
||||
<key>CheckQuitDownloading</key>
|
||||
<false/>
|
||||
<key>CheckRemove</key>
|
||||
<true/>
|
||||
<key>CheckRemoveDownloading</key>
|
||||
<false/>
|
||||
<key>CheckUpload</key>
|
||||
<true/>
|
||||
<key>DeleteOriginalTorrent</key>
|
||||
|
@ -30,8 +34,6 @@
|
|||
<string>Info</string>
|
||||
<key>InfoVisible</key>
|
||||
<false/>
|
||||
<key>Move</key>
|
||||
<false/>
|
||||
<key>MoveChoice</key>
|
||||
<string>Constant</string>
|
||||
<key>MoveFolder</key>
|
||||
|
|
2
macosx/English.lproj/PrefsWindow.nib/classes.nib
generated
2
macosx/English.lproj/PrefsWindow.nib/classes.nib
generated
|
@ -32,9 +32,11 @@
|
|||
fNetworkView = NSView;
|
||||
fPortField = NSTextField;
|
||||
fQuitCheck = NSButton;
|
||||
fQuitDownloadingCheck = NSButton;
|
||||
fRatioCheck = NSButton;
|
||||
fRatioField = NSTextField;
|
||||
fRemoveCheck = NSButton;
|
||||
fRemoveDownloadingCheck = NSButton;
|
||||
fStartMatrix = NSMatrix;
|
||||
fTransfersView = NSView;
|
||||
fUpdatePopUp = NSPopUpButton;
|
||||
|
|
3
macosx/English.lproj/PrefsWindow.nib/info.nib
generated
3
macosx/English.lproj/PrefsWindow.nib/info.nib
generated
|
@ -7,7 +7,7 @@
|
|||
<key>IBEditorPositions</key>
|
||||
<dict>
|
||||
<key>28</key>
|
||||
<string>308 472 535 212 0 0 1152 842 </string>
|
||||
<string>308 454 535 247 0 0 1152 842 </string>
|
||||
<key>41</key>
|
||||
<string>308 405 535 345 0 0 1152 842 </string>
|
||||
<key>66</key>
|
||||
|
@ -17,7 +17,6 @@
|
|||
<string>446.1</string>
|
||||
<key>IBOpenObjects</key>
|
||||
<array>
|
||||
<integer>41</integer>
|
||||
<integer>28</integer>
|
||||
</array>
|
||||
<key>IBSystem Version</key>
|
||||
|
|
BIN
macosx/English.lproj/PrefsWindow.nib/keyedobjects.nib
generated
BIN
macosx/English.lproj/PrefsWindow.nib/keyedobjects.nib
generated
Binary file not shown.
|
@ -35,6 +35,7 @@
|
|||
|
||||
IBOutlet NSPopUpButton * fFolderPopUp;
|
||||
IBOutlet NSButton * fQuitCheck, * fRemoveCheck,
|
||||
* fQuitDownloadingCheck, * fRemoveDownloadingCheck,
|
||||
* fBadgeDownloadRateCheck, * fBadgeUploadRateCheck,
|
||||
* fCopyTorrentCheck, * fDeleteOriginalTorrentCheck;
|
||||
IBOutlet NSPopUpButton * fUpdatePopUp;
|
||||
|
|
|
@ -139,8 +139,16 @@
|
|||
[fRatioField setFloatValue: [fDefaults floatForKey: @"RatioLimit"]];
|
||||
|
||||
//set remove and quit prompts
|
||||
[fQuitCheck setState: [fDefaults boolForKey: @"CheckQuit"]];
|
||||
[fRemoveCheck setState: [fDefaults boolForKey: @"CheckRemove"]];
|
||||
BOOL isQuitCheck = [fDefaults boolForKey: @"CheckQuit"],
|
||||
isRemoveCheck = [fDefaults boolForKey: @"CheckRemove"];
|
||||
|
||||
[fQuitCheck setState: isQuitCheck];
|
||||
[fRemoveCheck setState: isRemoveCheck];
|
||||
|
||||
[fQuitDownloadingCheck setState: [fDefaults boolForKey: @"CheckQuitDownloading"]];
|
||||
[fQuitDownloadingCheck setEnabled: isQuitCheck];
|
||||
[fRemoveDownloadingCheck setState: [fDefaults boolForKey: @"CheckRemoveDownloading"]];
|
||||
[fRemoveDownloadingCheck setEnabled: isRemoveCheck];
|
||||
|
||||
//set dock badging
|
||||
[fBadgeDownloadRateCheck setState: [fDefaults boolForKey: @"BadgeDownloadRate"]];
|
||||
|
@ -382,10 +390,22 @@
|
|||
|
||||
- (void) setShowMessage: (id) sender
|
||||
{
|
||||
BOOL state = [sender state];
|
||||
|
||||
if (sender == fQuitCheck)
|
||||
[fDefaults setBool: [sender state] forKey: @"CheckQuit"];
|
||||
{
|
||||
[fDefaults setBool: state forKey: @"CheckQuit"];
|
||||
[fQuitDownloadingCheck setEnabled: state];
|
||||
}
|
||||
else if (sender == fRemoveCheck)
|
||||
[fDefaults setBool: [fRemoveCheck state] forKey: @"CheckRemove"];
|
||||
{
|
||||
[fDefaults setBool: state forKey: @"CheckRemove"];
|
||||
[fRemoveDownloadingCheck setEnabled: state];
|
||||
}
|
||||
if (sender == fQuitDownloadingCheck)
|
||||
[fDefaults setBool: state forKey: @"CheckQuitDownloading"];
|
||||
else if (sender == fRemoveDownloadingCheck)
|
||||
[fDefaults setBool: state forKey: @"CheckRemoveDownloading"];
|
||||
else;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue