mirror of https://github.com/zlatinb/muwire
reorganize the options view
parent
66bd249ed3
commit
01a45a89a8
|
@ -3,11 +3,13 @@ package com.muwire.gui
|
||||||
import griffon.core.artifact.GriffonView
|
import griffon.core.artifact.GriffonView
|
||||||
import griffon.inject.MVCMember
|
import griffon.inject.MVCMember
|
||||||
import griffon.metadata.ArtifactProviderFor
|
import griffon.metadata.ArtifactProviderFor
|
||||||
|
import groovy.swing.factory.TitledBorderFactory
|
||||||
|
|
||||||
import javax.swing.JDialog
|
import javax.swing.JDialog
|
||||||
import javax.swing.JPanel
|
import javax.swing.JPanel
|
||||||
import javax.swing.JTabbedPane
|
import javax.swing.JTabbedPane
|
||||||
import javax.swing.SwingConstants
|
import javax.swing.SwingConstants
|
||||||
|
import javax.swing.border.TitledBorder
|
||||||
|
|
||||||
import com.muwire.core.Core
|
import com.muwire.core.Core
|
||||||
|
|
||||||
|
@ -75,88 +77,115 @@ class OptionsView {
|
||||||
d.setResizable(false)
|
d.setResizable(false)
|
||||||
p = builder.panel {
|
p = builder.panel {
|
||||||
gridBagLayout()
|
gridBagLayout()
|
||||||
label(text : "Search in comments", constraints:gbc(gridx: 0, gridy:0))
|
panel (border : titledBorder(title : "Search Settings", border : etchedBorder(), titlePosition : TitledBorder.TOP),
|
||||||
searchCommentsCheckbox = checkBox(selected : bind {model.searchComments}, constraints : gbc(gridx:1, gridy:0))
|
constraints : gbc(gridx: 0, gridy : 0, fill : GridBagConstraints.HORIZONTAL)) {
|
||||||
|
gridBagLayout()
|
||||||
|
label(text : "Search in comments", constraints:gbc(gridx: 0, gridy:0, anchor : GridBagConstraints.LINE_START,
|
||||||
|
fill : GridBagConstraints.HORIZONTAL, weightx: 100))
|
||||||
|
searchCommentsCheckbox = checkBox(selected : bind {model.searchComments}, constraints : gbc(gridx:1, gridy:0,
|
||||||
|
anchor : GridBagConstraints.LINE_END, fill : GridBagConstraints.HORIZONTAL, weightx: 0))
|
||||||
|
label(text : "Allow browsing", constraints : gbc(gridx : 0, gridy : 1, anchor : GridBagConstraints.LINE_START,
|
||||||
|
fill : GridBagConstraints.HORIZONTAL, weightx: 100))
|
||||||
|
browseFilesCheckbox = checkBox(selected : bind {model.browseFiles}, constraints : gbc(gridx : 1, gridy : 1,
|
||||||
|
anchor : GridBagConstraints.LINE_END, fill : GridBagConstraints.HORIZONTAL, weightx: 0))
|
||||||
|
}
|
||||||
|
|
||||||
label(text : "Retry failed downloads every", constraints : gbc(gridx: 0, gridy: 1))
|
panel (border : titledBorder(title : "Download Settings", border : etchedBorder(), titlePosition : TitledBorder.TOP,
|
||||||
retryField = textField(text : bind { model.downloadRetryInterval }, columns : 2, constraints : gbc(gridx: 1, gridy: 1))
|
constraints : gbc(gridx : 0, gridy : 1, fill : GridBagConstraints.HORIZONTAL))) {
|
||||||
label(text : "seconds", constraints : gbc(gridx : 2, gridy: 1))
|
gridBagLayout()
|
||||||
|
label(text : "Retry failed downloads every", constraints : gbc(gridx: 0, gridy: 0, anchor : GridBagConstraints.LINE_START, weightx: 100))
|
||||||
|
retryField = textField(text : bind { model.downloadRetryInterval }, columns : 2,
|
||||||
|
constraints : gbc(gridx: 1, gridy: 0, anchor : GridBagConstraints.LINE_END, weightx: 0))
|
||||||
|
label(text : "seconds", constraints : gbc(gridx : 2, gridy: 0, weightx : 0, anchor : GridBagConstraints.LINE_START))
|
||||||
|
|
||||||
label(text : "Check for updates every", constraints : gbc(gridx : 0, gridy: 2))
|
label(text : "Save downloaded files to:", constraints: gbc(gridx:0, gridy:1, anchor : GridBagConstraints.LINE_START))
|
||||||
updateField = textField(text : bind {model.updateCheckInterval }, columns : 2, constraints : gbc(gridx : 1, gridy: 2))
|
label(text : bind {model.downloadLocation}, constraints: gbc(gridx:1, gridy:1, anchor : GridBagConstraints.LINE_START))
|
||||||
label(text : "hours", constraints : gbc(gridx: 2, gridy : 2))
|
button(text : "Choose", constraints : gbc(gridx : 2, gridy:1), downloadLocationAction)
|
||||||
|
|
||||||
label(text : "Download updates automatically", constraints: gbc(gridx :0, gridy : 3))
|
label(text : "Store incomplete files in:", constraints: gbc(gridx:0, gridy:2, anchor : GridBagConstraints.LINE_START))
|
||||||
autoDownloadUpdateCheckbox = checkBox(selected : bind {model.autoDownloadUpdate}, constraints : gbc(gridx:1, gridy : 3))
|
label(text : bind {model.incompleteLocation}, constraints: gbc(gridx:1, gridy:2, anchor : GridBagConstraints.LINE_START))
|
||||||
|
button(text : "Choose", constraints : gbc(gridx : 2, gridy:2), incompleteLocationAction)
|
||||||
|
}
|
||||||
|
|
||||||
label(text : "Share downloaded files", constraints : gbc(gridx : 0, gridy:4))
|
panel (border : titledBorder(title : "Sharing Settings", border : etchedBorder(), titlePosition : TitledBorder.TOP,
|
||||||
shareDownloadedCheckbox = checkBox(selected : bind {model.shareDownloadedFiles}, constraints : gbc(gridx :1, gridy:4))
|
constraints : gbc(gridx : 0, gridy : 2, fill : GridBagConstraints.HORIZONTAL))) {
|
||||||
|
gridBagLayout()
|
||||||
|
label(text : "Share downloaded files", constraints : gbc(gridx : 0, gridy:0, anchor : GridBagConstraints.LINE_START, weightx : 100))
|
||||||
|
shareDownloadedCheckbox = checkBox(selected : bind {model.shareDownloadedFiles}, constraints : gbc(gridx :1, gridy:0, weightx : 0))
|
||||||
|
|
||||||
label(text : "Share hidden files", constraints : gbc(gridx : 0, gridy:5))
|
label(text : "Share hidden files", constraints : gbc(gridx : 0, gridy:1, anchor : GridBagConstraints.LINE_START, weightx : 100))
|
||||||
shareHiddenCheckbox = checkBox(selected : bind {model.shareHiddenFiles}, constraints : gbc(gridx :1, gridy:5))
|
shareHiddenCheckbox = checkBox(selected : bind {model.shareHiddenFiles}, constraints : gbc(gridx :1, gridy:1, weightx : 0))
|
||||||
|
}
|
||||||
|
|
||||||
label(text : "Allow browsing", constraints : gbc(gridx : 0, gridy : 6))
|
panel (border : titledBorder(title : "Update Settings", border : etchedBorder(), titlePosition : TitledBorder.TOP,
|
||||||
browseFilesCheckbox = checkBox(selected : bind {model.browseFiles}, constraints : gbc(gridx : 1, gridy : 6))
|
constraints : gbc(gridx : 0, gridy : 3, fill : GridBagConstraints.HORIZONTAL))) {
|
||||||
|
gridBagLayout()
|
||||||
|
label(text : "Check for updates every", constraints : gbc(gridx : 0, gridy: 0, anchor : GridBagConstraints.LINE_START, weightx : 100))
|
||||||
|
updateField = textField(text : bind {model.updateCheckInterval }, columns : 2, constraints : gbc(gridx : 1, gridy: 0, weightx: 0))
|
||||||
|
label(text : "hours", constraints : gbc(gridx: 2, gridy : 0, weightx: 0, anchor : GridBagConstraints.LINE_START))
|
||||||
|
|
||||||
label(text : "Save downloaded files to:", constraints: gbc(gridx:0, gridy:7))
|
label(text : "Download updates automatically", constraints: gbc(gridx :0, gridy : 1, anchor : GridBagConstraints.LINE_START, weightx: 100))
|
||||||
button(text : "Choose", constraints : gbc(gridx : 1, gridy:7), downloadLocationAction)
|
autoDownloadUpdateCheckbox = checkBox(selected : bind {model.autoDownloadUpdate},
|
||||||
label(text : bind {model.downloadLocation}, constraints: gbc(gridx:0, gridy:8, gridwidth:2))
|
constraints : gbc(gridx:2, gridy : 1, anchor : GridBagConstraints.LINE_END, fill : GridBagConstraints.HORIZONTAL))
|
||||||
|
|
||||||
label(text : "Store incomplete files in:", constraints: gbc(gridx:0, gridy:9))
|
|
||||||
button(text : "Choose", constraints : gbc(gridx : 1, gridy:9), incompleteLocationAction)
|
|
||||||
label(text : bind {model.incompleteLocation}, constraints: gbc(gridx:0, gridy:10, gridwidth:2))
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
i = builder.panel {
|
i = builder.panel {
|
||||||
gridBagLayout()
|
gridBagLayout()
|
||||||
label(text : "Changing these settings requires a restart", constraints : gbc(gridx : 0, gridy : 0, gridwidth: 2))
|
label(text : "Changing these settings requires a restart", constraints : gbc(gridx : 0, gridy : 0, gridwidth: 2))
|
||||||
label(text : "Inbound Length", constraints : gbc(gridx:0, gridy:1))
|
label(text : "Inbound Length", constraints : gbc(gridx:0, gridy:1, anchor : GridBagConstraints.LINE_START))
|
||||||
inboundLengthField = textField(text : bind {model.inboundLength}, columns : 2, constraints : gbc(gridx:1, gridy:1))
|
inboundLengthField = textField(text : bind {model.inboundLength}, columns : 2, constraints : gbc(gridx:1, gridy:1))
|
||||||
label(text : "Inbound Quantity", constraints : gbc(gridx:0, gridy:2))
|
label(text : "Inbound Quantity", constraints : gbc(gridx:0, gridy:2, anchor : GridBagConstraints.LINE_START))
|
||||||
inboundQuantityField = textField(text : bind {model.inboundQuantity}, columns : 2, constraints : gbc(gridx:1, gridy:2))
|
inboundQuantityField = textField(text : bind {model.inboundQuantity}, columns : 2, constraints : gbc(gridx:1, gridy:2))
|
||||||
label(text : "Outbound Length", constraints : gbc(gridx:0, gridy:3))
|
label(text : "Outbound Length", constraints : gbc(gridx:0, gridy:3, anchor : GridBagConstraints.LINE_START))
|
||||||
outboundLengthField = textField(text : bind {model.outboundLength}, columns : 2, constraints : gbc(gridx:1, gridy:3))
|
outboundLengthField = textField(text : bind {model.outboundLength}, columns : 2, constraints : gbc(gridx:1, gridy:3))
|
||||||
label(text : "Outbound Quantity", constraints : gbc(gridx:0, gridy:4))
|
label(text : "Outbound Quantity", constraints : gbc(gridx:0, gridy:4, anchor : GridBagConstraints.LINE_START))
|
||||||
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))
|
||||||
|
|
||||||
Core core = application.context.get("core")
|
Core core = application.context.get("core")
|
||||||
if (core.router != null) {
|
if (core.router != null) {
|
||||||
label(text : "TCP Port", constraints : gbc(gridx :0, gridy: 5))
|
label(text : "TCP Port", constraints : gbc(gridx :0, gridy: 5, anchor : GridBagConstraints.LINE_START))
|
||||||
i2pNTCPPortField = textField(text : bind {model.i2pNTCPPort}, columns : 4, constraints : gbc(gridx:1, gridy:5))
|
i2pNTCPPortField = textField(text : bind {model.i2pNTCPPort}, columns : 4, constraints : gbc(gridx:1, gridy:5))
|
||||||
label(text : "UDP Port", constraints : gbc(gridx :0, gridy: 6))
|
label(text : "UDP Port", constraints : gbc(gridx :0, gridy: 6, anchor : GridBagConstraints.LINE_START))
|
||||||
i2pUDPPortField = textField(text : bind {model.i2pUDPPort}, columns : 4, constraints : gbc(gridx:1, gridy:6))
|
i2pUDPPortField = textField(text : bind {model.i2pUDPPort}, columns : 4, constraints : gbc(gridx:1, gridy:6))
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
u = builder.panel {
|
u = builder.panel {
|
||||||
gridBagLayout()
|
gridBagLayout()
|
||||||
label(text : "Changing font or look-and-feel requires a restart", constraints : gbc(gridx : 0, gridy : 0, gridwidth: 2))
|
panel (border : titledBorder(title : "Theme Settings (changes require restart)", border : etchedBorder(), titlePosition: TitledBorder.TOP,
|
||||||
label(text : "Look And Feel", constraints : gbc(gridx: 0, gridy:1))
|
constraints : gbc(gridx : 0, gridy : 0, fill : GridBagConstraints.HORIZONTAL))) {
|
||||||
lnfField = textField(text : bind {model.lnf}, columns : 4, constraints : gbc(gridx : 1, gridy : 1, anchor : GridBagConstraints.LINE_START))
|
gridBagLayout()
|
||||||
label(text : "Font", constraints : gbc(gridx: 0, gridy : 2))
|
label(text : "Look And Feel", constraints : gbc(gridx: 0, gridy:0, anchor : GridBagConstraints.LINE_START, weightx: 100))
|
||||||
fontField = textField(text : bind {model.font}, columns : 4, constraints : gbc(gridx : 1, gridy:2, anchor : GridBagConstraints.LINE_START))
|
lnfField = textField(text : bind {model.lnf}, columns : 4, constraints : gbc(gridx : 1, gridy : 0, anchor : GridBagConstraints.LINE_START))
|
||||||
|
label(text : "Font", constraints : gbc(gridx: 0, gridy : 1, anchor : GridBagConstraints.LINE_START, weightx: 100))
|
||||||
|
fontField = textField(text : bind {model.font}, columns : 4, constraints : gbc(gridx : 1, gridy:1, anchor : GridBagConstraints.LINE_START))
|
||||||
|
|
||||||
label(text : "Font Size", constraints : gbc(gridx: 0, gridy : 3))
|
label(text : "Font Size", constraints : gbc(gridx: 0, gridy : 2, anchor : GridBagConstraints.LINE_START, weightx : 100))
|
||||||
buttonGroup(id: "fontSizeGroup")
|
buttonGroup(id: "fontSizeGroup")
|
||||||
radioButton(text: "Automatic", selected : bind {model.automaticFontSize}, buttonGroup : fontSizeGroup,
|
radioButton(text: "Automatic", selected : bind {model.automaticFontSize}, buttonGroup : fontSizeGroup,
|
||||||
constraints : gbc(gridx : 1, gridy: 3, anchor : GridBagConstraints.LINE_START), automaticFontAction)
|
constraints : gbc(gridx : 1, gridy: 2, anchor : GridBagConstraints.LINE_START), automaticFontAction)
|
||||||
radioButton(text: "Custom", selected : bind {!model.automaticFontSize}, buttonGroup : fontSizeGroup,
|
radioButton(text: "Custom", selected : bind {!model.automaticFontSize}, buttonGroup : fontSizeGroup,
|
||||||
constraints : gbc(gridx : 1, gridy: 4, anchor : GridBagConstraints.LINE_START), customFontAction)
|
constraints : gbc(gridx : 1, gridy: 3, anchor : GridBagConstraints.LINE_START), customFontAction)
|
||||||
fontSizeField = textField(text : bind {model.customFontSize}, enabled : bind {!model.automaticFontSize}, constraints : gbc(gridx : 2, gridy : 4))
|
fontSizeField = textField(text : bind {model.customFontSize}, enabled : bind {!model.automaticFontSize}, constraints : gbc(gridx : 2, gridy : 3))
|
||||||
|
|
||||||
label(text : "Automatically Clear Cancelled Downloads", constraints: gbc(gridx: 0, gridy:5))
|
}
|
||||||
|
panel (border : titledBorder(title : "Other Settings", border : etchedBorder(), titlePosition : TitledBorder.TOP,
|
||||||
|
constraints : gbc(gridx : 0, gridy : 1, fill : GridBagConstraints.HORIZONTAL))) {
|
||||||
|
gridBagLayout()
|
||||||
|
label(text : "Automatically Clear Cancelled Downloads", constraints: gbc(gridx: 0, gridy:0, anchor : GridBagConstraints.LINE_START, weightx: 100))
|
||||||
clearCancelledDownloadsCheckbox = checkBox(selected : bind {model.clearCancelledDownloads},
|
clearCancelledDownloadsCheckbox = checkBox(selected : bind {model.clearCancelledDownloads},
|
||||||
constraints : gbc(gridx : 1, gridy:5, anchor : GridBagConstraints.LINE_START))
|
constraints : gbc(gridx : 1, gridy:0, anchor : GridBagConstraints.LINE_END))
|
||||||
label(text : "Automatically Clear Finished Downloads", constraints: gbc(gridx: 0, gridy:6))
|
label(text : "Automatically Clear Finished Downloads", constraints: gbc(gridx: 0, gridy:1, anchor : GridBagConstraints.LINE_START, weightx: 100))
|
||||||
clearFinishedDownloadsCheckbox = checkBox(selected : bind {model.clearFinishedDownloads},
|
clearFinishedDownloadsCheckbox = checkBox(selected : bind {model.clearFinishedDownloads},
|
||||||
constraints : gbc(gridx : 1, gridy:6, anchor : GridBagConstraints.LINE_START))
|
constraints : gbc(gridx : 1, gridy:1, anchor : GridBagConstraints.LINE_END))
|
||||||
label(text : "Smooth Download Speed Over (seconds)", constraints : gbc(gridx: 0, gridy : 7))
|
label(text : "Smooth Download Speed Over (seconds)", constraints : gbc(gridx: 0, gridy : 2, anchor : GridBagConstraints.LINE_START, weightx: 100))
|
||||||
speedSmoothSecondsField = textField(text : bind {model.speedSmoothSeconds},
|
speedSmoothSecondsField = textField(text : bind {model.speedSmoothSeconds},
|
||||||
constraints : gbc(gridx:1, gridy: 7, anchor : GridBagConstraints.LINE_START))
|
constraints : gbc(gridx:1, gridy: 2, anchor : GridBagConstraints.LINE_START))
|
||||||
label(text : "Exclude Local Files From Results", constraints: gbc(gridx:0, gridy:8))
|
label(text : "Exclude Local Files From Results", constraints: gbc(gridx:0, gridy:3, anchor : GridBagConstraints.LINE_START, weightx: 100))
|
||||||
excludeLocalResultCheckbox = checkBox(selected : bind {model.excludeLocalResult},
|
excludeLocalResultCheckbox = checkBox(selected : bind {model.excludeLocalResult},
|
||||||
constraints : gbc(gridx: 1, gridy : 8, anchor : GridBagConstraints.LINE_START))
|
constraints : gbc(gridx: 1, gridy : 3, anchor : GridBagConstraints.LINE_END))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
bandwidth = builder.panel {
|
bandwidth = builder.panel {
|
||||||
gridBagLayout()
|
gridBagLayout()
|
||||||
|
@ -168,13 +197,13 @@ class OptionsView {
|
||||||
}
|
}
|
||||||
trust = builder.panel {
|
trust = builder.panel {
|
||||||
gridBagLayout()
|
gridBagLayout()
|
||||||
label(text : "Allow only trusted connections", constraints : gbc(gridx: 0, gridy : 0))
|
label(text : "Allow only trusted connections", constraints : gbc(gridx: 0, gridy : 0, anchor : GridBagConstraints.LINE_START))
|
||||||
allowUntrustedCheckbox = checkBox(selected : bind {model.onlyTrusted}, constraints : gbc(gridx: 1, gridy : 0))
|
allowUntrustedCheckbox = checkBox(selected : bind {model.onlyTrusted}, constraints : gbc(gridx: 1, gridy : 0))
|
||||||
label(text : "Search extra hop", constraints : gbc(gridx:0, gridy:1))
|
label(text : "Search extra hop", constraints : gbc(gridx:0, gridy:1, anchor : GridBagConstraints.LINE_START))
|
||||||
searchExtraHopCheckbox = checkBox(selected : bind {model.searchExtraHop}, constraints : gbc(gridx: 1, gridy : 1))
|
searchExtraHopCheckbox = checkBox(selected : bind {model.searchExtraHop}, constraints : gbc(gridx: 1, gridy : 1))
|
||||||
label(text : "Allow others to view my trust list", constraints : gbc(gridx: 0, gridy : 2))
|
label(text : "Allow others to view my trust list", constraints : gbc(gridx: 0, gridy : 2, anchor : GridBagConstraints.LINE_START))
|
||||||
allowTrustListsCheckbox = checkBox(selected : bind {model.trustLists}, constraints : gbc(gridx: 1, gridy : 2))
|
allowTrustListsCheckbox = checkBox(selected : bind {model.trustLists}, constraints : gbc(gridx: 1, gridy : 2))
|
||||||
label(text : "Update trust lists every ", constraints : gbc(gridx:0, gridy:3))
|
label(text : "Update trust lists every ", constraints : gbc(gridx:0, gridy:3, anchor : GridBagConstraints.LINE_START))
|
||||||
trustListIntervalField = textField(text : bind {model.trustListInterval}, constraints:gbc(gridx:1, gridy:3))
|
trustListIntervalField = textField(text : bind {model.trustListInterval}, constraints:gbc(gridx:1, gridy:3))
|
||||||
label(text : "hours", constraints : gbc(gridx: 2, gridy:3))
|
label(text : "hours", constraints : gbc(gridx: 2, gridy:3))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue