Show how many times we've been browsed and increment hit counter
This commit is contained in:
@@ -47,6 +47,7 @@ class MainWindowView extends BasicWindow {
|
||||
private final Label connectionCount, incoming, outgoing
|
||||
private final Label known, failing, hopeless
|
||||
private final Label sharedFiles
|
||||
private final Label timesBrowsed
|
||||
private final Label updateStatus
|
||||
|
||||
public MainWindowView(String title, Core core, TextGUI textGUI, Screen screen, CliSettings props) {
|
||||
@@ -127,6 +128,7 @@ class MainWindowView extends BasicWindow {
|
||||
failing = new Label("0")
|
||||
hopeless = new Label("0")
|
||||
sharedFiles = new Label("0")
|
||||
timesBrowsed = new Label("0")
|
||||
updateStatus = new Label("Unknown")
|
||||
|
||||
statusPanel.with {
|
||||
@@ -142,6 +144,8 @@ class MainWindowView extends BasicWindow {
|
||||
addComponent(hopeless, layoutData)
|
||||
addComponent(new Label("Shared Files: "), layoutData)
|
||||
addComponent(sharedFiles, layoutData)
|
||||
addComponent(new Label("Times Browsed: "), layoutData)
|
||||
addComponent(timesBrowsed, layoutData)
|
||||
addComponent(new Label("Update Status: "), layoutData)
|
||||
addComponent(updateStatus, layoutData)
|
||||
}
|
||||
@@ -261,6 +265,7 @@ class MainWindowView extends BasicWindow {
|
||||
int failingHosts = core.hostCache.countFailingHosts()
|
||||
int hopelessHosts = core.hostCache.countHopelessHosts()
|
||||
int shared = core.fileManager.fileToSharedFile.size()
|
||||
int browsed = core.connectionAcceptor.browsed
|
||||
|
||||
incoming.setText(String.valueOf(inCon))
|
||||
outgoing.setText(String.valueOf(outCon))
|
||||
@@ -268,5 +273,6 @@ class MainWindowView extends BasicWindow {
|
||||
failing.setText(String.valueOf(failingHosts))
|
||||
hopeless.setText(String.valueOf(hopelessHosts))
|
||||
sharedFiles.setText(String.valueOf(shared))
|
||||
timesBrowsed.setText(String.valueOf(browsed))
|
||||
}
|
||||
}
|
||||
|
@@ -51,6 +51,8 @@ class ConnectionAcceptor {
|
||||
|
||||
private volatile shutdown
|
||||
|
||||
private volatile int browsed
|
||||
|
||||
ConnectionAcceptor(EventBus eventBus, UltrapeerConnectionManager manager,
|
||||
MuWireSettings settings, I2PAcceptor acceptor, HostCache hostCache,
|
||||
TrustService trustService, SearchManager searchManager, UploadManager uploadManager,
|
||||
@@ -339,6 +341,7 @@ class ConnectionAcceptor {
|
||||
return
|
||||
}
|
||||
|
||||
browsed++
|
||||
|
||||
os.write("200 OK\r\n".getBytes(StandardCharsets.US_ASCII))
|
||||
|
||||
@@ -349,6 +352,7 @@ class ConnectionAcceptor {
|
||||
DataOutputStream dos = new DataOutputStream(new GZIPOutputStream(os))
|
||||
JsonOutput jsonOutput = new JsonOutput()
|
||||
sharedFiles.each {
|
||||
it.hit()
|
||||
def obj = ResultsSender.sharedFileToObj(it, false)
|
||||
def json = jsonOutput.toJson(obj)
|
||||
dos.writeShort((short)json.length())
|
||||
|
@@ -36,8 +36,8 @@ class MuWireStatusController {
|
||||
|
||||
|
||||
model.sharedFiles = core.fileManager.fileToSharedFile.size()
|
||||
|
||||
model.downloads = core.downloadManager.downloaders.size()
|
||||
model.browsed = core.connectionAcceptor.browsed
|
||||
}
|
||||
|
||||
@ControllerAction
|
||||
|
@@ -20,6 +20,7 @@ class MuWireStatusModel {
|
||||
@Observable int hopelessHosts
|
||||
@Observable int sharedFiles
|
||||
@Observable int downloads
|
||||
@Observable int browsed
|
||||
|
||||
void mvcGroupInit(Map<String,String> args) {
|
||||
controller.refresh()
|
||||
|
@@ -62,6 +62,8 @@ class MuWireStatusView {
|
||||
label(text : bind {model.sharedFiles}, constraints : gbc(gridx:1, gridy:0, anchor : GridBagConstraints.LINE_END))
|
||||
label(text : "Downloading", constraints : gbc(gridx:0, gridy:1, anchor : GridBagConstraints.LINE_START, weightx : 100))
|
||||
label(text : bind {model.downloads}, constraints : gbc(gridx:1, gridy:1, anchor : GridBagConstraints.LINE_END))
|
||||
label(text : "Times Browsed", constraints : gbc(gridx:0, gridy:2, anchor: GridBagConstraints.LINE_START, weightx: 100))
|
||||
label(text : bind {model.browsed}, constraints : gbc(gridx: 1, gridy: 2, anchor : GridBagConstraints.LINE_END))
|
||||
}
|
||||
}
|
||||
buttonsPanel = builder.panel {
|
||||
|
Reference in New Issue
Block a user