UI options panel
This commit is contained in:
@@ -66,6 +66,34 @@ class OptionsController {
|
|||||||
settings.write(it)
|
settings.write(it)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// UI Setttings
|
||||||
|
|
||||||
|
UISettings uiSettings = application.context.get("ui-settings")
|
||||||
|
text = view.lnfField.text
|
||||||
|
model.lnf = text
|
||||||
|
uiSettings.lnf = text
|
||||||
|
|
||||||
|
text = view.fontField.text
|
||||||
|
model.font = text
|
||||||
|
uiSettings.font = text
|
||||||
|
|
||||||
|
boolean showMonitor = view.monitorCheckbox.model.isSelected()
|
||||||
|
model.showMonitor = showMonitor
|
||||||
|
uiSettings.showMonitor = showMonitor
|
||||||
|
|
||||||
|
boolean clearCancelledDownloads = view.clearCancelledDownloadsCheckbox.model.isSelected()
|
||||||
|
model.clearCancelledDownloads = clearCancelledDownloads
|
||||||
|
uiSettings.clearCancelledDownloads = clearCancelledDownloads
|
||||||
|
|
||||||
|
boolean clearFinishedDownloads = view.clearFinishedDownloadsCheckbox.model.isSelected()
|
||||||
|
model.clearFinishedDownloads = clearFinishedDownloads
|
||||||
|
uiSettings.clearFinishedDownloads = clearFinishedDownloads
|
||||||
|
|
||||||
|
File uiSettingsFile = new File(core.home, "gui.properties")
|
||||||
|
uiSettingsFile.withOutputStream {
|
||||||
|
uiSettings.write(it)
|
||||||
|
}
|
||||||
|
|
||||||
cancel()
|
cancel()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -20,6 +20,13 @@ class OptionsModel {
|
|||||||
@Observable String outboundLength
|
@Observable String outboundLength
|
||||||
@Observable String outboundQuantity
|
@Observable String outboundQuantity
|
||||||
|
|
||||||
|
// gui options
|
||||||
|
@Observable boolean showMonitor
|
||||||
|
@Observable String lnf
|
||||||
|
@Observable String font
|
||||||
|
@Observable boolean clearCancelledDownloads
|
||||||
|
@Observable boolean clearFinishedDownloads
|
||||||
|
|
||||||
void mvcGroupInit(Map<String, String> args) {
|
void mvcGroupInit(Map<String, String> args) {
|
||||||
MuWireSettings settings = application.context.get("muwire-settings")
|
MuWireSettings settings = application.context.get("muwire-settings")
|
||||||
downloadRetryInterval = settings.downloadRetryInterval
|
downloadRetryInterval = settings.downloadRetryInterval
|
||||||
@@ -32,5 +39,12 @@ class OptionsModel {
|
|||||||
inboundQuantity = core.i2pOptions["inbound.quantity"]
|
inboundQuantity = core.i2pOptions["inbound.quantity"]
|
||||||
outboundLength = core.i2pOptions["outbound.length"]
|
outboundLength = core.i2pOptions["outbound.length"]
|
||||||
outboundQuantity = core.i2pOptions["outbound.quantity"]
|
outboundQuantity = core.i2pOptions["outbound.quantity"]
|
||||||
|
|
||||||
|
UISettings uiSettings = application.context.get("ui-settings")
|
||||||
|
showMonitor = uiSettings.showMonitor
|
||||||
|
lnf = uiSettings.lnf
|
||||||
|
font = uiSettings.font
|
||||||
|
clearCancelledDownloads = uiSettings.clearCancelledDownloads
|
||||||
|
clearFinishedDownloads = uiSettings.clearFinishedDownloads
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -25,6 +25,8 @@ class OptionsView {
|
|||||||
def d
|
def d
|
||||||
def p
|
def p
|
||||||
def i
|
def i
|
||||||
|
def u
|
||||||
|
|
||||||
def retryField
|
def retryField
|
||||||
def updateField
|
def updateField
|
||||||
def allowUntrustedCheckbox
|
def allowUntrustedCheckbox
|
||||||
@@ -35,6 +37,12 @@ class OptionsView {
|
|||||||
def outboundLengthField
|
def outboundLengthField
|
||||||
def outboundQuantityField
|
def outboundQuantityField
|
||||||
|
|
||||||
|
def lnfField
|
||||||
|
def monitorCheckbox
|
||||||
|
def fontField
|
||||||
|
def clearCancelledDownloadsCheckbox
|
||||||
|
def clearFinishedDownloadsCheckbox
|
||||||
|
|
||||||
def buttonsPanel
|
def buttonsPanel
|
||||||
|
|
||||||
def mainFrame
|
def mainFrame
|
||||||
@@ -72,6 +80,20 @@ class OptionsView {
|
|||||||
label(text : "Outbound Quantity", constraints : gbc(gridx:0, gridy:4))
|
label(text : "Outbound Quantity", constraints : gbc(gridx:0, gridy:4))
|
||||||
outboundQuantityField = textField(text : bind {model.outboundQuantity}, columns : 2, constraints : gbc(gridx:1, gridy:4))
|
outboundQuantityField = textField(text : bind {model.outboundQuantity}, columns : 2, constraints : gbc(gridx:1, gridy:4))
|
||||||
}
|
}
|
||||||
|
u = builder.panel {
|
||||||
|
gridBagLayout()
|
||||||
|
label(text : "Changing these settings requires a restart", constraints : gbc(gridx : 0, gridy : 0, gridwidth: 2))
|
||||||
|
label(text : "Look And Feel", constraints : gbc(gridx: 0, gridy:1))
|
||||||
|
lnfField = textField(text : bind {model.lnf}, columns : 4, constraints : gbc(gridx : 1, gridy : 1))
|
||||||
|
label(text : "Font", constraints : gbc(gridx: 0, gridy : 2))
|
||||||
|
fontField = textField(text : bind {model.font}, columns : 4, constraints : gbc(gridx : 1, gridy:2))
|
||||||
|
label(text : "Show Monitor", constraints : gbc(gridx :0, gridy: 3))
|
||||||
|
monitorCheckbox = checkBox(selected : bind {model.showMonitor}, constraints : gbc(gridx : 1, gridy: 3))
|
||||||
|
label(text : "Clear Cancelled Downloads", constraints: gbc(gridx: 0, gridy:4))
|
||||||
|
clearCancelledDownloadsCheckbox = checkBox(selected : bind {model.clearCancelledDownloads}, constraints : gbc(gridx : 1, gridy:4))
|
||||||
|
label(text : "Clear Finished Downloads", constraints: gbc(gridx: 0, gridy:5))
|
||||||
|
clearFinishedDownloadsCheckbox = checkBox(selected : bind {model.clearFinishedDownloads}, constraints : gbc(gridx : 1, gridy:5))
|
||||||
|
}
|
||||||
buttonsPanel = builder.panel {
|
buttonsPanel = builder.panel {
|
||||||
gridBagLayout()
|
gridBagLayout()
|
||||||
button(text : "Save", constraints : gbc(gridx : 1, gridy: 2), saveAction)
|
button(text : "Save", constraints : gbc(gridx : 1, gridy: 2), saveAction)
|
||||||
@@ -81,8 +103,9 @@ class OptionsView {
|
|||||||
|
|
||||||
void mvcGroupInit(Map<String,String> args) {
|
void mvcGroupInit(Map<String,String> args) {
|
||||||
def tabbedPane = new JTabbedPane()
|
def tabbedPane = new JTabbedPane()
|
||||||
tabbedPane.addTab("MuWire Options", p)
|
tabbedPane.addTab("MuWire", p)
|
||||||
tabbedPane.addTab("I2P Options", i)
|
tabbedPane.addTab("I2P", i)
|
||||||
|
tabbedPane.addTab("GUI", u)
|
||||||
|
|
||||||
JPanel panel = new JPanel()
|
JPanel panel = new JPanel()
|
||||||
panel.setLayout(new BorderLayout())
|
panel.setLayout(new BorderLayout())
|
||||||
|
@@ -5,19 +5,27 @@ class UISettings {
|
|||||||
String lnf
|
String lnf
|
||||||
boolean showMonitor
|
boolean showMonitor
|
||||||
String font
|
String font
|
||||||
|
boolean clearCancelledDownloads
|
||||||
|
boolean clearFinishedDownloads
|
||||||
|
|
||||||
UISettings(Properties props) {
|
UISettings(Properties props) {
|
||||||
lnf = props.getProperty("lnf", "system")
|
lnf = props.getProperty("lnf", "system")
|
||||||
showMonitor = Boolean.parseBoolean(props.getProperty("showMonitor", "true"))
|
showMonitor = Boolean.parseBoolean(props.getProperty("showMonitor", "true"))
|
||||||
font = props.getProperty("font",null)
|
font = props.getProperty("font",null)
|
||||||
|
clearCancelledDownloads = Boolean.parseBoolean(props.getProperty("clearCancelledDownloads","false"))
|
||||||
|
clearFinishedDownloads = Boolean.parseBoolean(props.getProperty("clearFinishedDownloads","false"))
|
||||||
}
|
}
|
||||||
|
|
||||||
void write(OutputStream out) throws IOException {
|
void write(OutputStream out) throws IOException {
|
||||||
Properties props = new Properties()
|
Properties props = new Properties()
|
||||||
props.setProperty("lnf", lnf)
|
props.setProperty("lnf", lnf)
|
||||||
props.setProperty("showMonitor", showMonitor)
|
props.setProperty("showMonitor", String.valueOf(showMonitor))
|
||||||
|
props.setProperty("clearCancelledDownloads", String.valueOf(clearCancelledDownloads))
|
||||||
|
props.setProperty("clearFinishedDownloads", String.valueOf(clearFinishedDownloads))
|
||||||
if (font != null)
|
if (font != null)
|
||||||
props.setProperty("font", font)
|
props.setProperty("font", font)
|
||||||
|
|
||||||
|
|
||||||
props.store(out, "UI Properties")
|
props.store(out, "UI Properties")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
7
gui/src/main/resources/trust.html
Normal file
7
gui/src/main/resources/trust.html
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
<html>
|
||||||
|
Some html goes here
|
||||||
|
<ul>
|
||||||
|
<li>1</li>
|
||||||
|
<li>2</li>
|
||||||
|
</ul>
|
||||||
|
</html>
|
Reference in New Issue
Block a user