mirror of https://github.com/zlatinb/muwire
show total up & down speeds
parent
01c9c0ee1c
commit
9fc2a0c4c5
|
@ -255,4 +255,10 @@ public class DownloadManager {
|
|||
public boolean isDownloading(InfoHash infoHash) {
|
||||
downloaders.containsKey(infoHash)
|
||||
}
|
||||
|
||||
public int totalDownloadSpeed() {
|
||||
int total = 0
|
||||
downloaders.values().each { total += it.speed() }
|
||||
total
|
||||
}
|
||||
}
|
||||
|
|
|
@ -144,6 +144,9 @@ class MainFrameModel {
|
|||
|
||||
@Observable Downloader downloader
|
||||
|
||||
@Observable int downSpeed
|
||||
@Observable int upSpeed
|
||||
|
||||
private final Set<InfoHash> downloadInfoHashes = new ConcurrentHashSet<>()
|
||||
|
||||
@Observable volatile Core core
|
||||
|
@ -208,6 +211,14 @@ class MainFrameModel {
|
|||
updateTablePreservingSelection("downloads-table")
|
||||
updateTablePreservingSelection("trusted-table")
|
||||
updateTablePreservingSelection("distrusted-table")
|
||||
|
||||
int totalUpload = 0
|
||||
uploads.each {
|
||||
totalUpload += it.speed()
|
||||
}
|
||||
upSpeed = totalUpload
|
||||
if (core != null)
|
||||
downSpeed = core.downloadManager.totalDownloadSpeed()
|
||||
}
|
||||
}, 1000, 1000)
|
||||
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 1.8 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.8 KiB |
|
@ -593,8 +593,21 @@ class MainFrameView {
|
|||
button(text : trans("COPY_SHORT"), constraints : gbc(gridx:1, gridy:0), copyShortAction)
|
||||
button(text : trans("COPY_FULL"), constraints : gbc(gridx:2, gridy:0), copyFullAction)
|
||||
}
|
||||
panel (constraints : BorderLayout.CENTER) {
|
||||
gridBagLayout()
|
||||
panel (constraints : gbc(gridx : 0, gridy : 0)){
|
||||
borderLayout()
|
||||
label(icon : imageIcon('/down_arrow.png'), constraints : BorderLayout.CENTER)
|
||||
label(text : bind { DataHelper.formatSize2Decimal(model.downSpeed, false) + trans("B_SEC") }, constraints : BorderLayout.EAST)
|
||||
}
|
||||
panel (constraints : gbc(gridx: 1, gridy : 0)){
|
||||
borderLayout()
|
||||
label(icon : imageIcon('/up_arrow.png'), constraints : BorderLayout.CENTER)
|
||||
label(text : bind { DataHelper.formatSize2Decimal(model.upSpeed, false) + trans("B_SEC") }, constraints : BorderLayout.EAST)
|
||||
}
|
||||
}
|
||||
panel (constraints : BorderLayout.EAST) {
|
||||
label(trans("CONNECTIONS") + ":")
|
||||
label(" " + trans("CONNECTIONS") + ":")
|
||||
label(text : bind {model.connections})
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue