share percentage slider

auto-update
Zlatin Balevsky 2021-09-07 09:08:43 +01:00
parent 1e1a4d0e56
commit 0b2fd2017a
No known key found for this signature in database
GPG Key ID: A72832072D525E41
6 changed files with 21 additions and 0 deletions

View File

@ -225,6 +225,7 @@ public class Core {
routerProps.setProperty("router.excludePeerCaps", i2pOptions["router.excludePeerCaps"])
routerProps.setProperty("i2np.inboundKBytesPerSecond", String.valueOf(props.inBw))
routerProps.setProperty("i2np.outboundKBytesPerSecond", String.valueOf(props.outBw))
routerProps.setProperty("router.sharePercentage", String.valueOf(props.sharePercentage))
routerProps.setProperty("i2cp.disableInterface", "true")
routerProps.setProperty("i2np.ntcp.nodelay", "true")
routerProps.setProperty("router.encType","4")

View File

@ -72,7 +72,10 @@ class MuWireSettings {
boolean embeddedRouter
boolean plugin
boolean disableUpdates
int inBw, outBw
int sharePercentage
Set<String> watchedKeywords
Set<String> watchedRegexes
Set<String> negativeFileTree
@ -117,6 +120,7 @@ class MuWireSettings {
disableUpdates = Boolean.valueOf(props.getProperty("disableUpdates","false"))
inBw = Integer.valueOf(props.getProperty("inBw","256"))
outBw = Integer.valueOf(props.getProperty("outBw","128"))
sharePercentage = Integer.valueOf(props.getProperty("sharePercentage","80"))
searchComments = Boolean.valueOf(props.getProperty("searchComments","true"))
searchCollections = Boolean.valueOf(props.getProperty("searchCollections","true"))
browseFiles = Boolean.valueOf(props.getProperty("browseFiles","true"))
@ -213,6 +217,7 @@ class MuWireSettings {
props.setProperty("disableUpdates", String.valueOf(disableUpdates))
props.setProperty("inBw", String.valueOf(inBw))
props.setProperty("outBw", String.valueOf(outBw))
props.setProperty("sharePercentage", String.valueOf(sharePercentage))
props.setProperty("searchComments", String.valueOf(searchComments))
props.setProperty("searchCollections", String.valueOf(searchCollections))
props.setProperty("browseFiles", String.valueOf(browseFiles))

View File

@ -149,6 +149,9 @@ class OptionsController {
text = view.outBwField.text
model.outBw = text
settings.outBw = Integer.valueOf(text)
int sharePercentage = view.sharePercentageSlider.value
model.sharePercentage = sharePercentage
settings.sharePercentage = sharePercentage
}
// feed saving

View File

@ -43,6 +43,7 @@ UDP_PORT=UDP port
BANDWIDTH_SETTINGS=Bandwidth Settings
INBOUND_BANDWIDTH=Inbound Bandwidth (KB)
OUTBOUND_BANDWIDTH=Outbound Bandwidth (KB)
SHARE_PERCENTAGE=Percent of bandwidth to share
INVALID_UDP_PORT=Invalid UDP Port
INVALID_TCP_PORT=Invalid TCP Port
INVALID_PORT=Invalid Port

View File

@ -61,6 +61,7 @@ class OptionsModel {
// bw options
@Observable String inBw
@Observable String outBw
@Observable int sharePercentage
// feed options
@Observable boolean fileFeed
@ -148,6 +149,7 @@ class OptionsModel {
if (core.router != null) {
inBw = String.valueOf(settings.inBw)
outBw = String.valueOf(settings.outBw)
sharePercentage = settings.sharePercentage
}
fileFeed = settings.fileFeed

View File

@ -81,6 +81,7 @@ class OptionsView {
def inBwField
def outBwField
def sharePercentageSlider
def fileFeedCheckbox
def advertiseFeedCheckbox
@ -336,6 +337,14 @@ class OptionsView {
inBwField = textField(text : bind {model.inBw}, columns : 3, constraints : gbc(gridx : 1, gridy : 0, anchor : GridBagConstraints.LINE_END))
label(text : trans("OUTBOUND_BANDWIDTH"), constraints : gbc(gridx: 0, gridy : 1, anchor : GridBagConstraints.LINE_START, weightx : 100))
outBwField = textField(text : bind {model.outBw}, columns : 3, constraints : gbc(gridx : 1, gridy : 1, anchor : GridBagConstraints.LINE_END))
label(text : trans("SHARE_PERCENTAGE"), constraints: gbc(gridx: 0, gridy: 2, anchor: GridBagConstraints.LINE_START, weightx: 50))
def quantityTable = new Hashtable()
quantityTable.put(0, new JLabel("0"))
quantityTable.put(50, new JLabel("50"))
quantityTable.put(100, new JLabel("100"))
sharePercentageSlider = slider(minimum : 0, maximum : 100, value : bind {model.sharePercentage},
majorTickSpacing : 5, snapToTicks : true, paintTicks: true, labelTable : quantityTable,
paintLabels : true, constraints: gbc(gridx: 1, gridy: 2, anchor: GridBagConstraints.LINE_END, weightx: 50))
}
panel(constraints : gbc(gridx: 0, gridy: 1, weighty: 100))
}