mirror of https://github.com/zlatinb/muwire
ability to chat from browse window
parent
631963f43c
commit
cf396b739e
|
@ -369,7 +369,12 @@ class ConnectionAcceptor {
|
|||
|
||||
def sharedFiles = fileManager.getSharedFiles().values()
|
||||
|
||||
os.write("Count: ${sharedFiles.size()}\r\n\r\n".getBytes(StandardCharsets.US_ASCII))
|
||||
os.write("Count: ${sharedFiles.size()}\r\n".getBytes(StandardCharsets.US_ASCII))
|
||||
|
||||
boolean chat = chatServer.running.get() && settings.advertiseChat
|
||||
os.write("Chat: ${chat}\r\n".getBytes(StandardCharsets.US_ASCII))
|
||||
|
||||
os.write("\r\n".getBytes(StandardCharsets.US_ASCII))
|
||||
|
||||
DataOutputStream dos = new DataOutputStream(new GZIPOutputStream(os))
|
||||
JsonOutput jsonOutput = new JsonOutput()
|
||||
|
|
|
@ -55,6 +55,8 @@ class BrowseManager {
|
|||
|
||||
int results = Integer.parseInt(headers['Count'])
|
||||
|
||||
boolean chat = headers.containsKey("Chat") && Boolean.parseBoolean(headers['Chat'])
|
||||
|
||||
// at this stage, start pulling the results
|
||||
eventBus.publish(new BrowseStatusEvent(status : BrowseStatus.FETCHING, totalResults : results))
|
||||
|
||||
|
@ -67,6 +69,7 @@ class BrowseManager {
|
|||
dis.readFully(tmp)
|
||||
def json = slurper.parse(tmp)
|
||||
UIResultEvent result = ResultsParser.parse(e.host, uuid, json)
|
||||
result.chat = chat
|
||||
eventBus.publish(result)
|
||||
}
|
||||
|
||||
|
|
|
@ -47,6 +47,7 @@ class BrowseController {
|
|||
|
||||
void onUIResultEvent(UIResultEvent e) {
|
||||
runInsideUIAsync {
|
||||
model.chatActionEnabled = e.chat
|
||||
model.results << e
|
||||
model.resultCount = model.results.size()
|
||||
view.resultsTable.model.fireTableDataChanged()
|
||||
|
@ -116,4 +117,13 @@ class BrowseController {
|
|||
params['core'] = core
|
||||
mvcGroup.createMVCGroup("fetch-certificates", params)
|
||||
}
|
||||
|
||||
@ControllerAction
|
||||
void chat() {
|
||||
dismiss()
|
||||
def mainFrameGroup = application.mvcGroupManager.getGroups()['MainFrame']
|
||||
|
||||
mainFrameGroup.controller.startChat(model.host)
|
||||
mainFrameGroup.view.showChatWindow.call()
|
||||
}
|
||||
}
|
|
@ -15,6 +15,7 @@ class BrowseModel {
|
|||
@Observable boolean downloadActionEnabled
|
||||
@Observable boolean viewCommentActionEnabled
|
||||
@Observable boolean viewCertificatesActionEnabled
|
||||
@Observable boolean chatActionEnabled
|
||||
@Observable int totalResults
|
||||
@Observable int resultCount
|
||||
|
||||
|
|
|
@ -68,6 +68,7 @@ class BrowseView {
|
|||
button(text : "Download", enabled : bind {model.downloadActionEnabled}, downloadAction)
|
||||
button(text : "View Comment", enabled : bind{model.viewCommentActionEnabled}, viewCommentAction)
|
||||
button(text : "View Certificates", enabled : bind{model.viewCertificatesActionEnabled}, viewCertificatesAction)
|
||||
button(text : "Chat", enabled : bind {model.chatActionEnabled}, chatAction)
|
||||
button(text : "Dismiss", dismissAction)
|
||||
label(text : "Download sequentially")
|
||||
sequentialDownloadCheckbox = checkBox()
|
||||
|
|
Loading…
Reference in New Issue