show the number of sources for a result, counted by infohash

pull/4/head
Zlatin Balevsky 2019-06-03 17:21:08 +01:00
parent 07dfc0a1d1
commit abbb741d73
2 changed files with 8 additions and 0 deletions

View File

@ -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()

View File

@ -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)