add a button to the bottom-left of the main window to clean up all completed transfers

This commit is contained in:
Mitchell Livingston 2011-03-10 01:36:51 +00:00
parent 97229c1813
commit 15394498b0
5 changed files with 110 additions and 18 deletions

View File

@ -149,6 +149,7 @@
A23547E211CD0B090046EAE6 /* cache.c in Sources */ = {isa = PBXBuildFile; fileRef = A23547E011CD0B090046EAE6 /* cache.c */; };
A23547E311CD0B090046EAE6 /* cache.h in Headers */ = {isa = PBXBuildFile; fileRef = A23547E111CD0B090046EAE6 /* cache.h */; };
A2385DD40BFE06C800B24EF6 /* DragOverlayWindow.m in Sources */ = {isa = PBXBuildFile; fileRef = A2385DD20BFE06C800B24EF6 /* DragOverlayWindow.m */; };
A23D5DA71320570800E422BA /* CleanupTemplate.png in Resources */ = {isa = PBXBuildFile; fileRef = A23D5DA61320570800E422BA /* CleanupTemplate.png */; };
A23F4FF20D1D98AD002FCB97 /* PrefsWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = A23F4FF00D1D98AD002FCB97 /* PrefsWindow.xib */; };
A23F50020D1D99D7002FCB97 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = A23F50000D1D99D7002FCB97 /* MainMenu.xib */; };
A23F526F0F14395900AA02E3 /* PredicateEditorRowTemplateAny.m in Sources */ = {isa = PBXBuildFile; fileRef = A23F526E0F14395900AA02E3 /* PredicateEditorRowTemplateAny.m */; };
@ -642,6 +643,7 @@
A23547E111CD0B090046EAE6 /* cache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = cache.h; path = libtransmission/cache.h; sourceTree = "<group>"; };
A2385DD20BFE06C800B24EF6 /* DragOverlayWindow.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = DragOverlayWindow.m; path = macosx/DragOverlayWindow.m; sourceTree = "<group>"; };
A2385DD30BFE06C800B24EF6 /* DragOverlayWindow.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = DragOverlayWindow.h; path = macosx/DragOverlayWindow.h; sourceTree = "<group>"; };
A23D5DA61320570800E422BA /* CleanupTemplate.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = CleanupTemplate.png; path = macosx/Images/CleanupTemplate.png; sourceTree = "<group>"; };
A23F526D0F14395900AA02E3 /* PredicateEditorRowTemplateAny.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PredicateEditorRowTemplateAny.h; path = macosx/PredicateEditorRowTemplateAny.h; sourceTree = "<group>"; };
A23F526E0F14395900AA02E3 /* PredicateEditorRowTemplateAny.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PredicateEditorRowTemplateAny.m; path = macosx/PredicateEditorRowTemplateAny.m; sourceTree = "<group>"; };
A245030B0D6A1FB000B49D00 /* UpArrowGroupTemplate.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = UpArrowGroupTemplate.png; path = macosx/Images/UpArrowGroupTemplate.png; sourceTree = "<group>"; };
@ -1243,6 +1245,7 @@
A26146E00DD4A0160060F033 /* GroupsNoneTemplate.png */,
A2F011980C27418800576FC0 /* CreateLarge.png */,
A22D3AA30D00D1790079CFED /* TurtleTemplate.png */,
A23D5DA61320570800E422BA /* CleanupTemplate.png */,
A277DA090C693D9C00DA2CD4 /* ActionOn.png */,
A2623B4D0D3DC6DF0045D19A /* ActionHover.png */,
35B037F90AC5B53800A10FDF /* ResumeNoWaitOn.png */,
@ -2093,6 +2096,7 @@
A2F7CF5513035F7B0016FF10 /* URLSheetWindow.xib in Resources */,
A2E57AC61310831400A7DAB1 /* StatusBar.xib in Resources */,
A2E57B9C13109DC200A7DAB1 /* FilterBar.xib in Resources */,
A23D5DA71320570800E422BA /* CleanupTemplate.png in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};

View File

@ -70,7 +70,7 @@ typedef enum
NSTimer * fTimer;
IBOutlet NSMenuItem * fOpenIgnoreDownloadFolder;
IBOutlet NSButton * fActionButton, * fSpeedLimitButton;
IBOutlet NSButton * fActionButton, * fSpeedLimitButton, * fClearCompletedButton;
IBOutlet NSTextField * fTotalTorrentsField;
StatusBarController * fStatusBar;

View File

@ -409,6 +409,8 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
"Main window -> 1st bottom left button (action) tooltip")];
[fSpeedLimitButton setToolTip: NSLocalizedString(@"Speed Limit overrides the total bandwidth limits with its own limits.",
"Main window -> 2nd bottom left button (turtle) tooltip")];
[fClearCompletedButton setToolTip: NSLocalizedString(@"Cleanup all transfers that have completed seeding.",
"Main window -> 3rd bottom left button (cleanup) tooltip")];
[fTableView registerForDraggedTypes: [NSArray arrayWithObject: TORRENT_TABLE_VIEW_DATA_TYPE]];
[fWindow registerForDraggedTypes: [NSArray arrayWithObjects: NSFilenamesPboardType, NSURLPboardType, nil]];
@ -1605,10 +1607,13 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
//pull the upload and download speeds - most consistent by using current stats
CGFloat dlRate = 0.0, ulRate = 0.0;
BOOL completed = NO;
for (Torrent * torrent in fTorrents)
{
dlRate += [torrent downloadRate];
ulRate += [torrent uploadRate];
completed |= [torrent isFinishedSeeding];
}
if (![NSApp isHidden])
@ -1618,6 +1623,8 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
[self sortTorrents];
[fStatusBar updateWithDownload: dlRate upload: ulRate];
[fClearCompletedButton setHidden: !completed];
}
//update non-constant parts of info window
@ -3368,21 +3375,21 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
return NO;
}
//set info image
//set info item
if ([ident isEqualToString: TOOLBAR_INFO])
{
[(NSButton *)[toolbarItem view] setState: [[fInfoController window] isVisible]];
return YES;
}
//set filter image
//set filter item
if ([ident isEqualToString: TOOLBAR_FILTER])
{
[(NSButton *)[toolbarItem view] setState: fFilterBar != nil];
return YES;
}
//set quick look image
//set quick look item
if ([ident isEqualToString: TOOLBAR_QUICKLOOK])
{
[(NSButton *)[toolbarItem view] setState: [NSApp isOnSnowLeopardOrBetter] && [QLPreviewPanelSL sharedPreviewPanelExists]
@ -3991,7 +3998,7 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
//get the torrent
Torrent * torrent = nil;
if (torrentStruct != NULL && (type != TR_RPC_TORRENT_ADDED && type != TR_RPC_SESSION_CHANGED))
if (torrentStruct != NULL && (type != TR_RPC_TORRENT_ADDED && type != TR_RPC_SESSION_CHANGED && type != TR_RPC_SESSION_CLOSE))
{
for (torrent in fTorrents)
if (torrentStruct == [torrent torrentStruct])

Binary file not shown.

After

Width:  |  Height:  |  Size: 446 B

View File

@ -12,7 +12,6 @@
</object>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
<integer value="1400"/>
<integer value="2"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
@ -60,7 +59,7 @@
<object class="NSPopUpButtonCell" key="NSCell" id="1063285887">
<int key="NSCellFlags">-2076049856</int>
<int key="NSCellFlags2">134219776</int>
<object class="NSFont" key="NSSupport">
<object class="NSFont" key="NSSupport" id="921632451">
<string key="NSName">LucidaGrande</string>
<double key="NSSize">13</double>
<int key="NSfFlags">1044</int>
@ -116,18 +115,14 @@
<object class="NSButton" id="673219624">
<reference key="NSNextResponder" ref="303120456"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{45, 3}, {36, 18}}</string>
<string key="NSFrame">{{44, 3}, {36, 18}}</string>
<reference key="NSSuperview" ref="303120456"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="109224088">
<int key="NSCellFlags">-2080244224</int>
<int key="NSCellFlags2">134348800</int>
<int key="NSCellFlags2">134217728</int>
<string key="NSContents"/>
<object class="NSFont" key="NSSupport" id="26">
<string key="NSName">LucidaGrande</string>
<double key="NSSize">11</double>
<int key="NSfFlags">3100</int>
</object>
<reference key="NSSupport" ref="921632451"/>
<reference key="NSControlView" ref="673219624"/>
<int key="NSButtonFlags">-935051009</int>
<int key="NSButtonFlags2">160</int>
@ -141,10 +136,34 @@
<int key="NSPeriodicInterval">75</int>
</object>
</object>
<object class="NSButton" id="52857407">
<reference key="NSNextResponder" ref="303120456"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{78, 3}, {36, 16}}</string>
<reference key="NSSuperview" ref="303120456"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="617399467">
<int key="NSCellFlags">-2080244224</int>
<int key="NSCellFlags2">134217728</int>
<string key="NSContents"/>
<reference key="NSSupport" ref="921632451"/>
<reference key="NSControlView" ref="52857407"/>
<int key="NSButtonFlags">138690815</int>
<int key="NSButtonFlags2">160</int>
<object class="NSCustomResource" key="NSNormalImage">
<string key="NSClassName">NSImage</string>
<string key="NSResourceName">CleanupTemplate</string>
</object>
<string key="NSAlternateContents"/>
<string key="NSKeyEquivalent"/>
<int key="NSPeriodicDelay">400</int>
<int key="NSPeriodicInterval">75</int>
</object>
</object>
<object class="NSTextField" id="403739499">
<reference key="NSNextResponder" ref="303120456"/>
<int key="NSvFlags">258</int>
<string key="NSFrame">{{86, 5}, {339, 14}}</string>
<string key="NSFrame">{{118, 5}, {279, 14}}</string>
<reference key="NSSuperview" ref="303120456"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="696487414">
@ -209,7 +228,11 @@
<int key="NSCellFlags">75628096</int>
<int key="NSCellFlags2">2048</int>
<string key="NSContents">Color</string>
<reference key="NSSupport" ref="26"/>
<object class="NSFont" key="NSSupport" id="26">
<string key="NSName">LucidaGrande</string>
<double key="NSSize">11</double>
<int key="NSfFlags">3100</int>
</object>
<object class="NSColor" key="NSBackgroundColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MC4zMzMzMzI5OQA</bytes>
@ -1634,7 +1657,7 @@ AAAAAAAAAAAAAAAAA</bytes>
</object>
<object class="NSMenuItem" id="96633809">
<reference key="NSMenu" ref="335948734"/>
<string key="NSTitle">Cleanup Completed</string>
<string key="NSTitle">Cleanup All Completed</string>
<string key="NSKeyEquiv"/>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="322614661"/>
@ -4051,6 +4074,22 @@ AAAAAAAAAAAAAAAAA</bytes>
</object>
<int key="connectionID">3409</int>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">clearCompleted:</string>
<reference key="source" ref="30116300"/>
<reference key="destination" ref="52857407"/>
</object>
<int key="connectionID">3424</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">fClearCompletedButton</string>
<reference key="source" ref="30116300"/>
<reference key="destination" ref="52857407"/>
</object>
<int key="connectionID">3425</int>
</object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
@ -4100,6 +4139,7 @@ AAAAAAAAAAAAAAAAA</bytes>
<reference ref="673219624"/>
<reference ref="87647552"/>
<reference ref="403739499"/>
<reference ref="52857407"/>
</object>
<reference key="parent" ref="405103408"/>
</object>
@ -5707,6 +5747,20 @@ AAAAAAAAAAAAAAAAA</bytes>
<reference key="object" ref="245039314"/>
<reference key="parent" ref="335948734"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">3420</int>
<reference key="object" ref="52857407"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="617399467"/>
</object>
<reference key="parent" ref="303120456"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">3421</int>
<reference key="object" ref="617399467"/>
<reference key="parent" ref="52857407"/>
</object>
</object>
</object>
<object class="NSMutableDictionary" key="flattenedProperties">
@ -6055,8 +6109,10 @@ AAAAAAAAAAAAAAAAA</bytes>
<string>2685.IBPluginDependency</string>
<string>2685.ImportedFromIB2</string>
<string>2690.IBPluginDependency</string>
<string>2690.IBViewBoundsToFrameTransform</string>
<string>2690.ImportedFromIB2</string>
<string>2700.IBPluginDependency</string>
<string>2700.IBViewBoundsToFrameTransform</string>
<string>2700.ImportedFromIB2</string>
<string>2839.IBPluginDependency</string>
<string>2839.ImportedFromIB2</string>
@ -6158,6 +6214,10 @@ AAAAAAAAAAAAAAAAA</bytes>
<string>3407.IBPluginDependency</string>
<string>3408.IBPluginDependency</string>
<string>3408.ImportedFromIB2</string>
<string>3420.IBPluginDependency</string>
<string>3420.IBViewBoundsToFrameTransform</string>
<string>3420.ImportedFromIB2</string>
<string>3421.IBPluginDependency</string>
<string>418.IBPluginDependency</string>
<string>418.ImportedFromIB2</string>
<string>456.IBEditorWindowLastContentRect</string>
@ -6558,8 +6618,14 @@ AAAAAAAAAAAAAAAAA</bytes>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<object class="NSAffineTransform">
<bytes key="NSTransformStruct">P4AAAL+AAABCNAAAwZgAAA</bytes>
</object>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<object class="NSAffineTransform">
<bytes key="NSTransformStruct">P4AAAL+AAABCrAAAwYgAAA</bytes>
</object>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
@ -6662,6 +6728,12 @@ AAAAAAAAAAAAAAAAA</bytes>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<object class="NSAffineTransform">
<bytes key="NSTransformStruct">P4AAAL+AAABCogAAwYgAAA</bytes>
</object>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>{{586, 242}, {291, 313}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
@ -6732,7 +6804,7 @@ AAAAAAAAAAAAAAAAA</bytes>
</object>
</object>
<nil key="sourceID"/>
<int key="maxID">3409</int>
<int key="maxID">3429</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
@ -7107,6 +7179,7 @@ AAAAAAAAAAAAAAAAA</bytes>
<bool key="EncodedWithXMLCoder">YES</bool>
<string>fActionButton</string>
<string>fCheckRatioItem</string>
<string>fClearCompletedButton</string>
<string>fDockMenu</string>
<string>fDownloadLimitItem</string>
<string>fDownloadMenu</string>
@ -7132,6 +7205,7 @@ AAAAAAAAAAAAAAAAA</bytes>
<bool key="EncodedWithXMLCoder">YES</bool>
<string>NSButton</string>
<string>NSMenuItem</string>
<string>NSButton</string>
<string>NSMenu</string>
<string>NSMenuItem</string>
<string>NSMenu</string>
@ -7160,6 +7234,7 @@ AAAAAAAAAAAAAAAAA</bytes>
<bool key="EncodedWithXMLCoder">YES</bool>
<string>fActionButton</string>
<string>fCheckRatioItem</string>
<string>fClearCompletedButton</string>
<string>fDockMenu</string>
<string>fDownloadLimitItem</string>
<string>fDownloadMenu</string>
@ -7191,6 +7266,10 @@ AAAAAAAAAAAAAAAAA</bytes>
<string key="name">fCheckRatioItem</string>
<string key="candidateClassName">NSMenuItem</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">fClearCompletedButton</string>
<string key="candidateClassName">NSButton</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">fDockMenu</string>
<string key="candidateClassName">NSMenu</string>
@ -8786,6 +8865,7 @@ AAAAAAAAAAAAAAAAA</bytes>
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>CleanupTemplate</string>
<string>NSActionTemplate</string>
<string>NSMenuCheckmark</string>
<string>NSMenuMixedState</string>
@ -8796,6 +8876,7 @@ AAAAAAAAAAAAAAAAA</bytes>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>{18, 18}</string>
<string>{15, 15}</string>
<string>{9, 8}</string>
<string>{7, 2}</string>