diff --git a/gui/griffon-app/views/com/muwire/gui/OptionsView.groovy b/gui/griffon-app/views/com/muwire/gui/OptionsView.groovy index 875954b2..b0c6e5f7 100644 --- a/gui/griffon-app/views/com/muwire/gui/OptionsView.groovy +++ b/gui/griffon-app/views/com/muwire/gui/OptionsView.groovy @@ -3,11 +3,13 @@ package com.muwire.gui import griffon.core.artifact.GriffonView import griffon.inject.MVCMember import griffon.metadata.ArtifactProviderFor +import groovy.swing.factory.TitledBorderFactory import javax.swing.JDialog import javax.swing.JPanel import javax.swing.JTabbedPane import javax.swing.SwingConstants +import javax.swing.border.TitledBorder import com.muwire.core.Core @@ -75,88 +77,115 @@ class OptionsView { d.setResizable(false) p = builder.panel { gridBagLayout() - label(text : "Search in comments", constraints:gbc(gridx: 0, gridy:0)) - searchCommentsCheckbox = checkBox(selected : bind {model.searchComments}, constraints : gbc(gridx:1, gridy:0)) + panel (border : titledBorder(title : "Search Settings", border : etchedBorder(), titlePosition : TitledBorder.TOP), + 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)) - retryField = textField(text : bind { model.downloadRetryInterval }, columns : 2, constraints : gbc(gridx: 1, gridy: 1)) - label(text : "seconds", constraints : gbc(gridx : 2, gridy: 1)) - - label(text : "Check for updates every", constraints : gbc(gridx : 0, gridy: 2)) - updateField = textField(text : bind {model.updateCheckInterval }, columns : 2, constraints : gbc(gridx : 1, gridy: 2)) - label(text : "hours", constraints : gbc(gridx: 2, gridy : 2)) - - label(text : "Download updates automatically", constraints: gbc(gridx :0, gridy : 3)) - autoDownloadUpdateCheckbox = checkBox(selected : bind {model.autoDownloadUpdate}, constraints : gbc(gridx:1, gridy : 3)) - - label(text : "Share downloaded files", constraints : gbc(gridx : 0, gridy:4)) - shareDownloadedCheckbox = checkBox(selected : bind {model.shareDownloadedFiles}, constraints : gbc(gridx :1, gridy:4)) + panel (border : titledBorder(title : "Download Settings", border : etchedBorder(), titlePosition : TitledBorder.TOP, + constraints : gbc(gridx : 0, gridy : 1, fill : GridBagConstraints.HORIZONTAL))) { + 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 : "Save downloaded files to:", constraints: gbc(gridx:0, gridy:1, anchor : GridBagConstraints.LINE_START)) + label(text : bind {model.downloadLocation}, constraints: gbc(gridx:1, gridy:1, anchor : GridBagConstraints.LINE_START)) + button(text : "Choose", constraints : gbc(gridx : 2, gridy:1), downloadLocationAction) + + label(text : "Store incomplete files in:", constraints: gbc(gridx:0, gridy:2, anchor : GridBagConstraints.LINE_START)) + 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 hidden files", constraints : gbc(gridx : 0, gridy:5)) - shareHiddenCheckbox = checkBox(selected : bind {model.shareHiddenFiles}, constraints : gbc(gridx :1, gridy:5)) + panel (border : titledBorder(title : "Sharing Settings", border : etchedBorder(), titlePosition : TitledBorder.TOP, + 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:1, anchor : GridBagConstraints.LINE_START, weightx : 100)) + shareHiddenCheckbox = checkBox(selected : bind {model.shareHiddenFiles}, constraints : gbc(gridx :1, gridy:1, weightx : 0)) + } - label(text : "Allow browsing", constraints : gbc(gridx : 0, gridy : 6)) - browseFilesCheckbox = checkBox(selected : bind {model.browseFiles}, constraints : gbc(gridx : 1, gridy : 6)) + panel (border : titledBorder(title : "Update Settings", border : etchedBorder(), titlePosition : TitledBorder.TOP, + 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)) - button(text : "Choose", constraints : gbc(gridx : 1, gridy:7), downloadLocationAction) - label(text : bind {model.downloadLocation}, constraints: gbc(gridx:0, gridy:8, gridwidth:2)) - - 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)) + label(text : "Download updates automatically", constraints: gbc(gridx :0, gridy : 1, anchor : GridBagConstraints.LINE_START, weightx: 100)) + autoDownloadUpdateCheckbox = checkBox(selected : bind {model.autoDownloadUpdate}, + constraints : gbc(gridx:2, gridy : 1, anchor : GridBagConstraints.LINE_END, fill : GridBagConstraints.HORIZONTAL)) + } } i = builder.panel { gridBagLayout() 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)) - 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)) - 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)) - 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)) Core core = application.context.get("core") 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)) - 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)) } } u = builder.panel { gridBagLayout() - label(text : "Changing font or look-and-feel 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, anchor : GridBagConstraints.LINE_START)) - label(text : "Font", constraints : gbc(gridx: 0, gridy : 2)) - fontField = textField(text : bind {model.font}, columns : 4, constraints : gbc(gridx : 1, gridy:2, anchor : GridBagConstraints.LINE_START)) - - label(text : "Font Size", constraints : gbc(gridx: 0, gridy : 3)) - buttonGroup(id: "fontSizeGroup") - radioButton(text: "Automatic", selected : bind {model.automaticFontSize}, buttonGroup : fontSizeGroup, - constraints : gbc(gridx : 1, gridy: 3, anchor : GridBagConstraints.LINE_START), automaticFontAction) - radioButton(text: "Custom", selected : bind {!model.automaticFontSize}, buttonGroup : fontSizeGroup, - constraints : gbc(gridx : 1, gridy: 4, anchor : GridBagConstraints.LINE_START), customFontAction) - fontSizeField = textField(text : bind {model.customFontSize}, enabled : bind {!model.automaticFontSize}, constraints : gbc(gridx : 2, gridy : 4)) - - label(text : "Automatically Clear Cancelled Downloads", constraints: gbc(gridx: 0, gridy:5)) - clearCancelledDownloadsCheckbox = checkBox(selected : bind {model.clearCancelledDownloads}, - constraints : gbc(gridx : 1, gridy:5, anchor : GridBagConstraints.LINE_START)) - label(text : "Automatically Clear Finished Downloads", constraints: gbc(gridx: 0, gridy:6)) - clearFinishedDownloadsCheckbox = checkBox(selected : bind {model.clearFinishedDownloads}, - constraints : gbc(gridx : 1, gridy:6, anchor : GridBagConstraints.LINE_START)) - label(text : "Smooth Download Speed Over (seconds)", constraints : gbc(gridx: 0, gridy : 7)) - speedSmoothSecondsField = textField(text : bind {model.speedSmoothSeconds}, - constraints : gbc(gridx:1, gridy: 7, anchor : GridBagConstraints.LINE_START)) - label(text : "Exclude Local Files From Results", constraints: gbc(gridx:0, gridy:8)) - excludeLocalResultCheckbox = checkBox(selected : bind {model.excludeLocalResult}, - constraints : gbc(gridx: 1, gridy : 8, anchor : GridBagConstraints.LINE_START)) - + panel (border : titledBorder(title : "Theme Settings (changes require restart)", border : etchedBorder(), titlePosition: TitledBorder.TOP, + constraints : gbc(gridx : 0, gridy : 0, fill : GridBagConstraints.HORIZONTAL))) { + gridBagLayout() + label(text : "Look And Feel", constraints : gbc(gridx: 0, gridy:0, anchor : GridBagConstraints.LINE_START, weightx: 100)) + 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 : 2, anchor : GridBagConstraints.LINE_START, weightx : 100)) + buttonGroup(id: "fontSizeGroup") + radioButton(text: "Automatic", selected : bind {model.automaticFontSize}, buttonGroup : fontSizeGroup, + constraints : gbc(gridx : 1, gridy: 2, anchor : GridBagConstraints.LINE_START), automaticFontAction) + radioButton(text: "Custom", selected : bind {!model.automaticFontSize}, buttonGroup : fontSizeGroup, + 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 : 3)) + + } + 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}, + constraints : gbc(gridx : 1, gridy:0, anchor : GridBagConstraints.LINE_END)) + label(text : "Automatically Clear Finished Downloads", constraints: gbc(gridx: 0, gridy:1, anchor : GridBagConstraints.LINE_START, weightx: 100)) + clearFinishedDownloadsCheckbox = checkBox(selected : bind {model.clearFinishedDownloads}, + constraints : gbc(gridx : 1, gridy:1, anchor : GridBagConstraints.LINE_END)) + 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}, + constraints : gbc(gridx:1, gridy: 2, anchor : GridBagConstraints.LINE_START)) + 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}, + constraints : gbc(gridx: 1, gridy : 3, anchor : GridBagConstraints.LINE_END)) + } } bandwidth = builder.panel { gridBagLayout() @@ -168,13 +197,13 @@ class OptionsView { } trust = builder.panel { 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)) - 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)) - 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)) - 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)) label(text : "hours", constraints : gbc(gridx: 2, gridy:3)) }