1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2025-03-03 10:15:45 +00:00

update progress bar when seeding immediately when the stop ratio setting is changed

This commit is contained in:
Mitchell Livingston 2007-03-22 19:16:08 +00:00
parent 92637d591e
commit 1c0e5ca701
9 changed files with 33 additions and 16 deletions

View file

@ -152,7 +152,7 @@
- (void) updateControlTint: (NSNotification *) notification;
- (void) updateUI: (NSTimer *) timer;
- (void) updateUI;
- (void) updateTorrentsInQueue;

View file

@ -324,6 +324,9 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
//observe notifications
NSNotificationCenter * nc = [NSNotificationCenter defaultCenter];
[nc addObserver: self selector: @selector(updateUI)
name: @"UpdateUI" object: nil];
[nc addObserver: fInfoController selector: @selector(updateInfoSettings)
name: @"UpdateInfoSettings" object: nil];
@ -362,9 +365,9 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
//timer to update the interface every second
fCompleted = 0;
[self updateUI: nil];
[self updateUI];
fTimer = [NSTimer scheduledTimerWithTimeInterval: UPDATE_UI_SECONDS target: self
selector: @selector(updateUI:) userInfo: nil repeats: YES];
selector: @selector(updateUI) userInfo: nil repeats: YES];
[[NSRunLoop currentRunLoop] addTimer: fTimer forMode: NSModalPanelRunLoopMode];
[[NSRunLoop currentRunLoop] addTimer: fTimer forMode: NSEventTrackingRunLoopMode];
@ -899,7 +902,7 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
while ((torrent = [enumerator nextObject]))
[torrent startTransfer];
[self updateUI: nil];
[self updateUI];
[self applyFilter: nil];
[self updateTorrentHistory];
}
@ -924,7 +927,7 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
[torrents makeObjectsPerformSelector: @selector(stopTransfer)];
[self updateUI: nil];
[self updateUI];
[self applyFilter: nil];
[self updateTorrentHistory];
}
@ -1051,7 +1054,7 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
[fTableView deselectAll: nil];
[self updateUI: nil];
[self updateUI];
[self applyFilter: nil];
[self updateTorrentHistory];
@ -1191,7 +1194,7 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
[fMessageController showWindow: nil];
}
- (void) updateUI: (NSTimer *) timer
- (void) updateUI
{
[fTorrents makeObjectsPerformSelector: @selector(update)];
@ -1289,7 +1292,7 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
}
}
[self updateUI: nil];
[self updateUI];
[self applyFilter: nil];
[self updateTorrentHistory];
}
@ -2067,7 +2070,7 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
}
}
[self updateUI: nil];
[self updateUI];
//set views to not autoresize
unsigned int statsMask = [fStatusBar autoresizingMask];

View file

@ -5,6 +5,7 @@
{CLASS = NSDatePicker; LANGUAGE = ObjC; SUPERCLASS = NSControl; },
{
ACTIONS = {
applyRatioSetting = id;
applySpeedSettings = id;
folderSheetShow = id;
helpForNetwork = id;

View file

@ -9,9 +9,9 @@
<key>153</key>
<string>294 445 563 268 0 0 1152 842 </string>
<key>28</key>
<string>156 256 571 290 0 0 1152 842 </string>
<string>294 433 563 290 0 0 1152 842 </string>
<key>41</key>
<string>170 417 563 305 0 0 1152 842 </string>
<string>189 445 563 305 0 0 1152 842 </string>
<key>66</key>
<string>294 507 563 144 0 0 1152 842 </string>
</dict>
@ -23,9 +23,9 @@
</array>
<key>IBOpenObjects</key>
<array>
<integer>41</integer>
<integer>28</integer>
</array>
<key>IBSystem Version</key>
<string>8L127</string>
<string>8P135</string>
</dict>
</plist>

View file

@ -872,6 +872,8 @@
[torrent setRatioSetting: setting];
[fRatioLimitField setHidden: setting != NSOnState];
[[NSNotificationCenter defaultCenter] postNotificationName: @"UpdateUI" object: nil];
}
- (void) setRatioLimit: (id) sender
@ -898,6 +900,8 @@
while ((torrent = [enumerator nextObject]))
[torrent setRatioLimit: ratioLimit];
}
[[NSNotificationCenter defaultCenter] postNotificationName: @"UpdateUI" object: nil];
}
@end

View file

@ -77,6 +77,7 @@
- (void) setNat: (id) sender;
- (void) updateNatStatus;
- (void) applyRatioSetting: (id) sender;
- (void) updateRatioStopField;
- (void) setRatioStop: (id) sender;

View file

@ -340,12 +340,19 @@
}
}
- (void) applyRatioSetting: (id) sender
{
[[NSNotificationCenter defaultCenter] postNotificationName: @"UpdateUI" object: nil];
}
- (void) updateRatioStopField
{
if (!fHasLoaded)
return;
[fRatioStopField setFloatValue: [fDefaults floatForKey: @"RatioLimit"]];
[self applyRatioSetting: nil];
}
- (void) setRatioStop: (id) sender
@ -359,6 +366,8 @@
}
[fDefaults setFloat: ratio forKey: @"RatioLimit"];
[self applyRatioSetting: nil];
}
- (void) updateLimitFields

View file

@ -99,7 +99,7 @@
isActive = [[info objectForKey: @"Active"] boolValue];
float completedWidth, remainingWidth;
//bar images
//bar images and widths
NSImage * barLeftEnd, * barRightEnd, * barComplete, * barRemaining;
if (seeding)
{
@ -139,13 +139,12 @@
barRemaining = fProgressWhite;
}
//place bar
[barLeftEnd compositeToPoint: point operation: NSCompositeSourceOver];
//active bar
point.x += 1.0;
[self placeBar: barComplete width: completedWidth point: point];
//remaining bar
point.x += completedWidth;
[self placeBar: barRemaining width: remainingWidth point: point];