mirror of https://github.com/zlatinb/muwire
show the number of sources for a result, counted by infohash
parent
07dfc0a1d1
commit
abbb741d73
|
@ -21,6 +21,7 @@ class SearchTabModel {
|
|||
Core core
|
||||
String uuid
|
||||
def results = []
|
||||
def hashCount = [:]
|
||||
|
||||
|
||||
void mvcGroupInit(Map<String, String> args) {
|
||||
|
@ -34,6 +35,12 @@ class SearchTabModel {
|
|||
|
||||
void handleResult(UIResultEvent e) {
|
||||
runInsideUIAsync {
|
||||
Integer count = hashCount.get(e.infohash)
|
||||
if (count == null)
|
||||
count = 0
|
||||
count++
|
||||
hashCount[e.infohash] = count
|
||||
|
||||
results << e
|
||||
JTable table = builder.getVariable("results-table")
|
||||
table.model.fireTableDataChanged()
|
||||
|
|
|
@ -31,6 +31,7 @@ class SearchTabView {
|
|||
tableModel(list: model.results) {
|
||||
closureColumn(header: "Name", type: String, read : {row -> row.name})
|
||||
closureColumn(header: "Size", preferredWidth: 150, type: Long, read : {row -> row.size})
|
||||
closureColumn(header: "Sources", type : Integer, read : { row -> model.hashCount[row.infohash]})
|
||||
closureColumn(header: "Sender", type: String, read : {row -> row.sender.getHumanReadableName()})
|
||||
closureColumn(header: "Trust", type: String, read : {row ->
|
||||
model.core.trustService.getLevel(row.sender.destination)
|
||||
|
|
Loading…
Reference in New Issue