ui for chat options
This commit is contained in:
@@ -372,8 +372,6 @@ public class Core {
|
||||
connectionEstablisher.start()
|
||||
hostCache.waitForLoad()
|
||||
updateClient.start()
|
||||
if (muOptions.startChatServer)
|
||||
chatServer.start()
|
||||
}
|
||||
|
||||
public void shutdown() {
|
||||
|
@@ -33,6 +33,7 @@ class MuWireSettings {
|
||||
boolean browseFiles
|
||||
boolean startChatServer
|
||||
int maxChatConnections
|
||||
boolean advertiseChat
|
||||
Set<String> watchedDirectories
|
||||
float downloadSequentialRatio
|
||||
int hostClearInterval, hostHopelessInterval, hostRejectInterval
|
||||
@@ -83,6 +84,7 @@ class MuWireSettings {
|
||||
uploadSlotsPerUser = Integer.valueOf(props.getProperty("uploadSlotsPerUser","-1"))
|
||||
startChatServer = Boolean.valueOf(props.getProperty("startChatServer","false"))
|
||||
maxChatConnections = Integer.valueOf(props.get("maxChatConnections", "-1"))
|
||||
advertiseChat = Boolean.valueOf(props.getProperty("advertiseChat","true"))
|
||||
|
||||
watchedDirectories = DataUtil.readEncodedSet(props, "watchedDirectories")
|
||||
watchedKeywords = DataUtil.readEncodedSet(props, "watchedKeywords")
|
||||
@@ -133,6 +135,7 @@ class MuWireSettings {
|
||||
props.setProperty("uploadSlotsPerUser", String.valueOf(uploadSlotsPerUser))
|
||||
props.setProperty("startChatServer", String.valueOf(startChatServer))
|
||||
props.setProperty("maxChatConnectios", String.valueOf(maxChatConnections))
|
||||
props.setProperty("advertiseChat", String.valueOf(advertiseChat))
|
||||
|
||||
DataUtil.writeEncodedSet(watchedDirectories, "watchedDirectories", props)
|
||||
DataUtil.writeEncodedSet(watchedKeywords, "watchedKeywords", props)
|
||||
|
@@ -140,6 +140,18 @@ class OptionsController {
|
||||
model.trustListInterval = trustListInterval
|
||||
settings.trustListInterval = Integer.parseInt(trustListInterval)
|
||||
|
||||
boolean startChatServer = view.startChatServerCheckbox.model.isSelected()
|
||||
model.startChatServer = startChatServer
|
||||
settings.startChatServer = startChatServer
|
||||
|
||||
String maxChatConnections = view.maxChatConnectionsField.text
|
||||
model.maxChatConnections = Integer.parseInt(maxChatConnections)
|
||||
settings.maxChatConnections = Integer.parseInt(maxChatConnections)
|
||||
|
||||
boolean advertiseChat = view.advertiseChatCheckbox.model.isSelected()
|
||||
model.advertiseChat = advertiseChat
|
||||
settings.advertiseChat = advertiseChat
|
||||
|
||||
core.saveMuSettings()
|
||||
|
||||
// UI Setttings
|
||||
|
@@ -257,6 +257,10 @@ class MainFrameModel {
|
||||
uploadsPaneButtonEnabled = true
|
||||
monitorPaneButtonEnabled = true
|
||||
trustPaneButtonEnabled = true
|
||||
chatPaneButtonEnabled = true
|
||||
|
||||
if (core.muOptions.startChatServer)
|
||||
controller.startChatServer()
|
||||
}
|
||||
})
|
||||
|
||||
|
@@ -56,6 +56,10 @@ class OptionsModel {
|
||||
@Observable boolean trustLists
|
||||
@Observable String trustListInterval
|
||||
|
||||
// chat options
|
||||
@Observable boolean startChatServer
|
||||
@Observable int maxChatConnections
|
||||
@Observable boolean advertiseChat
|
||||
|
||||
void mvcGroupInit(Map<String, String> args) {
|
||||
MuWireSettings settings = application.context.get("muwire-settings")
|
||||
@@ -104,5 +108,9 @@ class OptionsModel {
|
||||
searchExtraHop = settings.searchExtraHop
|
||||
trustLists = settings.allowTrustLists
|
||||
trustListInterval = String.valueOf(settings.trustListInterval)
|
||||
|
||||
startChatServer = settings.startChatServer
|
||||
maxChatConnections = settings.maxChatConnections
|
||||
advertiseChat = settings.advertiseChat
|
||||
}
|
||||
}
|
@@ -33,6 +33,7 @@ class OptionsView {
|
||||
def u
|
||||
def bandwidth
|
||||
def trust
|
||||
def chat
|
||||
|
||||
def retryField
|
||||
def updateField
|
||||
@@ -71,6 +72,10 @@ class OptionsView {
|
||||
def allowTrustListsCheckbox
|
||||
def trustListIntervalField
|
||||
|
||||
def startChatServerCheckbox
|
||||
def maxChatConnectionsField
|
||||
def advertiseChatCheckbox
|
||||
|
||||
def buttonsPanel
|
||||
|
||||
def mainFrame
|
||||
@@ -268,6 +273,21 @@ class OptionsView {
|
||||
panel(constraints : gbc(gridx: 0, gridy : 1, weighty: 100))
|
||||
}
|
||||
|
||||
chat = builder.panel {
|
||||
gridBagLayout()
|
||||
panel (border : titledBorder(title : "Chat Settings", border : etchedBorder(), titlePosition : TitledBorder.TOP),
|
||||
constraints : gbc(gridx : 0, gridy : 0, fill : GridBagConstraints.HORIZONTAL, weightx: 100)) {
|
||||
gridBagLayout()
|
||||
label(text : "Start chat server on startup", constraints : gbc(gridx: 0, gridy: 0, anchor: GridBagConstraints.LINE_START, weightx: 100))
|
||||
startChatServerCheckbox = checkBox(selected : bind{model.startChatServer}, constraints : gbc(gridx:1, gridy:0, anchor:GridBagConstraints.LINE_END))
|
||||
label(text : "Maximum chat connections (-1 means unlimited)", constraints : gbc(gridx: 0, gridy:1, anchor:GridBagConstraints.LINE_START, weightx:100))
|
||||
maxChatConnectionsField = textField(text : bind {model.maxChatConnections}, constraints : gbc(gridx: 1, gridy : 1, anchor:GridBagConstraints.LINE_END))
|
||||
label(text : "Advertise chat ability in search results", constraints : gbc(gridx: 0, gridy:2, anchor:GridBagConstraints.LINE_START, weightx:100))
|
||||
advertiseChatCheckbox = checkBox(selected : bind{model.advertiseChat}, constraints : gbc(gridx:1, gridy:2, anchor:GridBagConstraints.LINE_END))
|
||||
}
|
||||
panel(constraints : gbc(gridx: 0, gridy : 1, weighty: 100))
|
||||
}
|
||||
|
||||
|
||||
buttonsPanel = builder.panel {
|
||||
gridBagLayout()
|
||||
@@ -286,6 +306,7 @@ class OptionsView {
|
||||
tabbedPane.addTab("Bandwidth", bandwidth)
|
||||
}
|
||||
tabbedPane.addTab("Trust", trust)
|
||||
tabbedPane.addTab("Chat", chat)
|
||||
|
||||
JPanel panel = new JPanel()
|
||||
panel.setLayout(new BorderLayout())
|
||||
|
Reference in New Issue
Block a user