externalize strings in Options gui

This commit is contained in:
Zlatin Balevsky
2020-09-29 09:45:14 +01:00
parent b47634d916
commit 82f75affa4
2 changed files with 173 additions and 86 deletions

View File

@ -240,3 +240,89 @@ CHAT_HOSTS=Chat Hosts
# Search table popup menu
COPY_NAME_TO_CLIPBOARD=Copy name to clipboard
## Options pane
# MuWire tab
OPTIONS_SEARCH_SETTINGS=Search Settings
OPTIONS_SEARCH_IN_COMMENTS=Search in comments
OPTIONS_ALLOW_BROWSING=Allow browsing
OPTIONS_ALLOW_TRACKING=Allow tracking
OPTIONS_DOWNLOAD_SETTINGS=Download Settings
OPTIONS_RETRY_FAILED_DOWNLOADS=Retry failed downloads every (seconds)
OPTIONS_GIVE_UP_SOURCES=Give up on sources after this many failures (-1 means never)
OPTIONS_SAVE_DOWNLOADED_FILES=Save downloaded files to
OPTIONS_STORE_INCOMPLETE_FILES=Store incomplete files in
OPTIONS_UPLOAD_SETTINGS=Upload Settings
OPTIONS_TOTAL_UPLOAD_SLOTS=Total upload slots (-1 means unlimited)
OPTIONS_UPLOAD_SLOTS_PER_USER=Upload slots per user (-1 means unlimited)
OPTIONS_SHARING_SETTINGS=Sharing Settings
OPTIONS_SHARE_DOWNLOADED_FILES=Share downloaded files
OPTIONS_SHARE_HIDDEN_FILES=Share hidden files
OPTIONS_UPDATE_SETTINGS=Update Settings
OPTIONS_CHECK_FOR_UPDATES=Check for updates every (hours)
OPTIONS_DOWNLOAD_UPDATES=Download updates automatically
# I2P tab
OPTIONS_CHANGING_I2P_SETTINGS=Changing any I2P settings requires a restart
OPTIONS_TUNNEL_SETTINGS=Tunnel Settings
# GUI tab
OPTIONS_THEME_SETTINGS=Theme Settings (changes require restart)
OPTIONS_LOOK_AND_FEEL=Look And Feel
OPTIONS_FONT=Font
OPTIONS_FONT_SIZE=Font size
OPTIONS_AUTOMATIC=Automatic
OPTIONS_CUSTOM=Custom
OPTIONS_FONT_STYLE=Font style
OPTIONS_BOLD=Bold
OPTIONS_ITALIC=Italic
OPTIONS_SEARCH_SETTINGS=Search Settings
OPTIONS_DEFAULT_GROUP_RESULTS=By default, group search results by
OPTIONS_REMEMBER_HISTORY=Remember search history
OPTIONS_CLEAR_HISTORY=Clear history
OPTIONS_OTHER_SETTINGS=Other Settings
OPTIONS_CLEAR_CANCELLED_DOWNLOADS=Automatically clear cancelled downloads
OPTIONS_CLEAR_FINISHED_DOWNLOADS=Automatically clear finished downloads
OPTIONS_SMOOTH_DOWNLOAD_SPEED=Smooth download speed over (seconds)
OPTIONS_EXCLUDE_LOCAL_FILES=Excluse local files from results
OPTIONS_CLEAR_FINISHED_UPLOADS=Automatically clear finished uploads
OPTIONS_WHEN_CLOSING_MUWIRE=When closing MuWire
OPTIONS_MINIMIZE_TO_TRAY=Minimize to tray
# Bandwidth tab
OPTIONS_BANDWIDTH_SETTINGS=Changing bandwidth settings requires a restart
# Feed tab
OPTIONS_FEED_SETTINGS=General Feed Settings
OPTIONS_ENABLE_FEED=Enable file feed
OPTIONS_ADVERTISE_FEED=Advertise feed in search results
OPTIONS_PUBLISH_SHARED=Automatically publish shared files
OPTIONS_NEW_FEED_DEFAULTS=Default Settings For New Feeds
OPTIONS_FEED_AUTO_DOWNLOAD=Automatically download files from feed
OPTIONS_FEED_DOWNLOAD_SEQUENTIALLY=Download files from feed sequentially
OPTIONS_FEED_ITEMS_ON_DISK=Feed items to store on disk (-1 means unlimited)
OPTIONS_FEED_REFRESH_FREQUENCY=Feed refresh frequency in minutes
# Trust tab
OPTIONS_TRUST_SETTINGS=Trust Settings
OPTIONS_ONLY_TRUSTED=Allow only trusted connections
OPTIONS_SEARCH_EXTRA_HOP=Search extra hop
OPTIONS_ALLOW_TRUST_LIST=Allow others to view my trust list
OPTIONS_TRUST_LIST_UPDATE_INTERVAL=Update trust lists every (hours)
# Chat tab
OPTIONS_CHAT_SETTINGS=Chat Settings
OPTIONS_START_CHAT_SERVER_STARTUP=Start chat server on startup
OPTIONS_MAX_CHAT_CONNECTIONS=Maximum chat connections (-1 means unlimited)
OPTIONS_ADVERTISE_CHAT=Advertise chat ability in search results
OPTIONS_MAX_CHAT_SCROLLBACK=Maximum lines of scrollback (-1 means unlimited)
OPTIONS_CHAT_WELCOME_FILE=Welcome message file
# Buttons panel
SAVE=Save
# The tabs themselves
GUI=GUI
BANDWIDTH=Bandwidth

View File

@ -1,6 +1,7 @@
package com.muwire.gui
import griffon.core.artifact.GriffonView
import static com.muwire.gui.Translator.trans
import griffon.inject.MVCMember
import griffon.metadata.ArtifactProviderFor
import groovy.swing.factory.TitledBorderFactory
@ -100,72 +101,72 @@ class OptionsView {
d.setResizable(false)
p = builder.panel {
gridBagLayout()
panel (border : titledBorder(title : "Search Settings", border : etchedBorder(), titlePosition : TitledBorder.TOP),
panel (border : titledBorder(title : trans("OPTIONS_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,
label(text : trans("OPTIONS_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,
label(text : trans("OPTIONS_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 : "Allow tracking", constraints : gbc(gridx: 0, gridy: 2, anchor: GridBagConstraints.LINE_START,
label(text : trans("OPTIONS_ALLOW_TRACKING"), constraints : gbc(gridx: 0, gridy: 2, anchor: GridBagConstraints.LINE_START,
fill : GridBagConstraints.HORIZONTAL, weightx: 100))
allowTrackingCheckbox = checkBox(selected : bind {model.allowTracking}, constraints : gbc(gridx: 1, gridy : 2,
anchor : GridBagConstraints.LINE_END, fill : GridBagConstraints.HORIZONTAL, weightx : 0))
}
panel (border : titledBorder(title : "Download Settings", border : etchedBorder(), titlePosition : TitledBorder.TOP,
panel (border : titledBorder(title : trans("OPTIONS_DOWNLOAD_SETTINGS"), border : etchedBorder(), titlePosition : TitledBorder.TOP,
constraints : gbc(gridx : 0, gridy : 1, fill : GridBagConstraints.HORIZONTAL))) {
gridBagLayout()
label(text : "Retry failed downloads every (seconds)", constraints : gbc(gridx: 0, gridy: 0, anchor : GridBagConstraints.LINE_START, weightx: 100))
label(text : trans("OPTIONS_RETRY_FAILED_DOWNLOADS"), constraints : gbc(gridx: 0, gridy: 0, anchor : GridBagConstraints.LINE_START, weightx: 100))
retryField = textField(text : bind { model.downloadRetryInterval }, columns : 2,
constraints : gbc(gridx: 2, gridy: 0, anchor : GridBagConstraints.LINE_END, weightx: 0))
label(text : "Give up on sources after this many failures (-1 means never)", constraints: gbc(gridx: 0, gridy: 1, anchor : GridBagConstraints.LINE_START, weightx: 100))
label(text : trans("OPTIONS_GIVE_UP_SOURCES"), constraints: gbc(gridx: 0, gridy: 1, anchor : GridBagConstraints.LINE_START, weightx: 100))
downloadMaxFailuresField = textField(text : bind { model.downloadMaxFailures }, columns : 2,
constraints : gbc(gridx: 2, gridy: 1, anchor : GridBagConstraints.LINE_END, weightx: 0))
label(text : "Save downloaded files to:", constraints: gbc(gridx:0, gridy:2, anchor : GridBagConstraints.LINE_START))
label(text : trans("OPTIONS_SAVE_DOWNLOADED_FILES") + ":", constraints: gbc(gridx:0, gridy:2, anchor : GridBagConstraints.LINE_START))
label(text : bind {model.downloadLocation}, constraints: gbc(gridx:1, gridy:2, anchor : GridBagConstraints.LINE_START))
button(text : "Choose", constraints : gbc(gridx : 2, gridy:2), downloadLocationAction)
button(text : trans("CHOOSE"), constraints : gbc(gridx : 2, gridy:2), downloadLocationAction)
label(text : "Store incomplete files in:", constraints: gbc(gridx:0, gridy:3, anchor : GridBagConstraints.LINE_START))
label(text : trans("OPTIONS_STORE_INCOMPLETE_FILES") + ":", constraints: gbc(gridx:0, gridy:3, anchor : GridBagConstraints.LINE_START))
label(text : bind {model.incompleteLocation}, constraints: gbc(gridx:1, gridy:3, anchor : GridBagConstraints.LINE_START))
button(text : "Choose", constraints : gbc(gridx : 2, gridy:3), incompleteLocationAction)
button(text : trans("CHOOSE"), constraints : gbc(gridx : 2, gridy:3), incompleteLocationAction)
}
panel (border : titledBorder(title : "Upload Settings", border : etchedBorder(), titlePosition : TitledBorder.TOP,
panel (border : titledBorder(title : trans("OPTIONS_UPLOAD_SETTINGS"), border : etchedBorder(), titlePosition : TitledBorder.TOP,
constraints : gbc(gridx : 0, gridy:2, fill : GridBagConstraints.HORIZONTAL))) {
gridBagLayout()
label(text : "Total upload slots (-1 means unlimited)", constraints : gbc(gridx: 0, gridy : 0, anchor : GridBagConstraints.LINE_START, weightx: 100))
label(text : trans("OPTIONS_TOTAL_UPLOAD_SLOTS"), constraints : gbc(gridx: 0, gridy : 0, anchor : GridBagConstraints.LINE_START, weightx: 100))
totalUploadSlotsField = textField(text : bind {model.totalUploadSlots}, columns: 2,
constraints : gbc(gridx : 1, gridy: 0, anchor : GridBagConstraints.LINE_END))
label(text : "Upload slots per user (-1 means unlimited)", constraints : gbc(gridx: 0, gridy : 1, anchor : GridBagConstraints.LINE_START, weightx: 100))
label(text : trans("OPTIONS_UPLOAD_SLOTS_PER_USER"), constraints : gbc(gridx: 0, gridy : 1, anchor : GridBagConstraints.LINE_START, weightx: 100))
uploadSlotsPerUserField = textField(text : bind {model.uploadSlotsPerUser}, columns: 2,
constraints : gbc(gridx : 1, gridy: 1, anchor : GridBagConstraints.LINE_END))
}
panel (border : titledBorder(title : "Sharing Settings", border : etchedBorder(), titlePosition : TitledBorder.TOP,
panel (border : titledBorder(title : trans("OPTIONS_SHARING_SETTINGS"), border : etchedBorder(), titlePosition : TitledBorder.TOP,
constraints : gbc(gridx : 0, gridy : 3, fill : GridBagConstraints.HORIZONTAL))) {
gridBagLayout()
label(text : "Share downloaded files", constraints : gbc(gridx : 0, gridy:0, anchor : GridBagConstraints.LINE_START, weightx : 100))
label(text : trans("OPTIONS_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))
label(text : trans("OPTIONS_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))
}
if (!model.disableUpdates) {
panel (border : titledBorder(title : "Update Settings", border : etchedBorder(), titlePosition : TitledBorder.TOP,
panel (border : titledBorder(title : trans("OPTIONS_UPDATE_SETTINGS"), border : etchedBorder(), titlePosition : TitledBorder.TOP,
constraints : gbc(gridx : 0, gridy : 4, fill : GridBagConstraints.HORIZONTAL))) {
gridBagLayout()
label(text : "Check for updates every (hours)", constraints : gbc(gridx : 0, gridy: 0, anchor : GridBagConstraints.LINE_START, weightx : 100))
label(text : trans("OPTIONS_CHECK_FOR_UPDATES"), 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 : "Download updates automatically", constraints: gbc(gridx :0, gridy : 1, anchor : GridBagConstraints.LINE_START, weightx: 100))
label(text : trans("OPTIONS_DOWNLOAD_UPDATES"), constraints: gbc(gridx :0, gridy : 1, anchor : GridBagConstraints.LINE_START, weightx: 100))
autoDownloadUpdateCheckbox = checkBox(selected : bind {model.autoDownloadUpdate},
constraints : gbc(gridx:1, gridy : 1, anchor : GridBagConstraints.LINE_END))
@ -174,24 +175,24 @@ class OptionsView {
}
i = builder.panel {
gridBagLayout()
label(text : "Changing any I2P settings requires a restart", constraints : gbc(gridx:0, gridy : 0))
panel (border : titledBorder(title : "Tunnel Settings", border : etchedBorder(), titlePosition: TitledBorder.TOP,
label(text : trans("OPTIONS_CHANGING_I2P_SETTINGS"), constraints : gbc(gridx:0, gridy : 0))
panel (border : titledBorder(title : trans("OPTIONS_TUNNEL_SETTINGS"), border : etchedBorder(), titlePosition: TitledBorder.TOP,
constraints : gbc(gridx: 0, gridy: 1, fill : GridBagConstraints.HORIZONTAL, weightx : 100))) {
gridLayout(rows:4, cols:1)
label(text : "Speed vs Anonymity")
label(text : trans("SPEED_VS_ANONYMITY"))
def lengthTable = new Hashtable()
lengthTable.put(1, new JLabel("Max Speed"))
lengthTable.put(3, new JLabel("Max Anonymity"))
lengthTable.put(1, new JLabel(trans("MAX_SPEED")))
lengthTable.put(3, new JLabel(trans("MAX_ANONYMITY")))
tunnelLengthSlider = slider(minimum : 1, maximum : 3, value : bind {model.tunnelLength},
majorTickSpacing : 1, snapToTicks: true, paintTicks: true, labelTable : lengthTable,
paintLabels : true)
label(text: "Reliability vs Resource Usage")
label(text: trans("RELIABILITY_VS_RESOURCES"))
def quantityTable = new Hashtable()
quantityTable.put(1, new JLabel("Min Resources"))
quantityTable.put(6, new JLabel("Max Reliability"))
quantityTable.put(1, new JLabel(trans("MIN_RESOURCES")))
quantityTable.put(6, new JLabel(trans("MAX_RELIABILITY")))
tunnelQuantitySlider = slider(minimum : 1, maximum : 6, value : bind {model.tunnelQuantity},
majorTickSpacing : 1, snapToTicks : true, paintTicks: true, labelTable : quantityTable,
paintLabels : true)
@ -199,12 +200,12 @@ class OptionsView {
Core core = application.context.get("core")
if (core.router != null) {
panel(border : titledBorder(title : "Port Settings", border : etchedBorder(), titlePosition : TitledBorder.TOP,
panel(border : titledBorder(title : trans("PORT_SETTINGS"), border : etchedBorder(), titlePosition : TitledBorder.TOP,
constraints : gbc(gridx: 0, gridy : 2, fill : GridBagConstraints.HORIZONTAL, weightx: 100))) {
gridBagLayout()
label(text : "TCP port", constraints : gbc(gridx :0, gridy: 0, anchor : GridBagConstraints.LINE_START, weightx : 100))
label(text : trans("TCP_PORT"), constraints : gbc(gridx :0, gridy: 0, anchor : GridBagConstraints.LINE_START, weightx : 100))
i2pNTCPPortField = textField(text : bind {model.i2pNTCPPort}, columns : 4, constraints : gbc(gridx:1, gridy:0, anchor : GridBagConstraints.LINE_END))
label(text : "UDP port", constraints : gbc(gridx :0, gridy: 1, anchor : GridBagConstraints.LINE_START, weightx : 100))
label(text : trans("UDP_PORT"), constraints : gbc(gridx :0, gridy: 1, anchor : GridBagConstraints.LINE_START, weightx : 100))
i2pUDPPortField = textField(text : bind {model.i2pUDPPort}, columns : 4, constraints : gbc(gridx:1, gridy:1, anchor : GridBagConstraints.LINE_END))
}
}
@ -213,124 +214,124 @@ class OptionsView {
}
u = builder.panel {
gridBagLayout()
panel (border : titledBorder(title : "Theme Settings (changes require restart)", border : etchedBorder(), titlePosition: TitledBorder.TOP,
panel (border : titledBorder(title : trans("OPTIONS_THEME_SETTINGS"), border : etchedBorder(), titlePosition: TitledBorder.TOP,
constraints : gbc(gridx : 0, gridy : 0, fill : GridBagConstraints.HORIZONTAL, weightx : 100))) {
gridBagLayout()
label(text : "Look And Feel", constraints : gbc(gridx: 0, gridy:0, anchor : GridBagConstraints.LINE_START, weightx: 100))
label(text : trans("OPTIONS_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 : 3, gridy : 0, anchor : GridBagConstraints.LINE_START))
label(text : "Font", constraints : gbc(gridx: 0, gridy : 1, anchor : GridBagConstraints.LINE_START, weightx: 100))
label(text : trans("OPTIONS_FONT"), constraints : gbc(gridx: 0, gridy : 1, anchor : GridBagConstraints.LINE_START, weightx: 100))
fontField = textField(text : bind {model.font}, columns : 4, constraints : gbc(gridx : 3, gridy:1, anchor : GridBagConstraints.LINE_START))
label(text : "Font size", constraints : gbc(gridx: 0, gridy : 2, anchor : GridBagConstraints.LINE_START, weightx : 100))
label(text : trans("OPTIONS_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,
radioButton(text: trans("OPTIONS_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,
radioButton(text: trans("OPTIONS_CUSTOM"), selected : bind {!model.automaticFontSize}, buttonGroup : fontSizeGroup,
constraints : gbc(gridx : 2, gridy: 2, anchor : GridBagConstraints.LINE_START), customFontAction)
fontSizeField = textField(text : bind {model.customFontSize}, enabled : bind {!model.automaticFontSize},
constraints : gbc(gridx : 3, gridy : 2, anchor : GridBagConstraints.LINE_END))
label(text : "Font style", constraints: gbc(gridx: 0, gridy: 3, anchor : GridBagConstraints.LINE_START, weightx: 100))
label(text : trans("OPTIONS_FONT_STYLE"), constraints: gbc(gridx: 0, gridy: 3, anchor : GridBagConstraints.LINE_START, weightx: 100))
panel(constraints : gbc(gridx: 2, gridy: 3, gridwidth: 2, anchor:GridBagConstraints.LINE_END)) {
fontStyleBoldCheckbox = checkBox(selected : bind {model.fontStyleBold})
label(text: "Bold")
label(text: trans("OPTIONS_BOLD"))
fontStyleItalicCheckbox = checkBox(selected : bind {model.fontStyleItalic})
label(text: "Italic")
label(text: trans("OPTIONS_ITALIC"))
}
}
panel (border : titledBorder(title : "Search Settings", border : etchedBorder(), titlePosition : TitledBorder.TOP),
panel (border : titledBorder(title : trans("OPTIONS_SEARCH_SETTINGS"), border : etchedBorder(), titlePosition : TitledBorder.TOP),
constraints : gbc(gridx : 0, gridy : 1, fill : GridBagConstraints.HORIZONTAL, weightx : 100)) {
gridBagLayout()
label(text : "By default, group search results by", constraints : gbc(gridx :0, gridy: 0, anchor : GridBagConstraints.LINE_START, weightx : 100))
label(text : trans("OPTIONS_DEFAULT_GROUP_RESULTS"), constraints : gbc(gridx :0, gridy: 0, anchor : GridBagConstraints.LINE_START, weightx : 100))
panel(constraints : gbc(gridx : 1, gridy : 0, anchor : GridBagConstraints.LINE_END)) {
buttonGroup(id : "groupBy")
radioButton(text : "Sender", selected : bind {!model.groupByFile}, buttonGroup : groupBy, groupBySenderAction)
radioButton(text : "File", selected : bind {model.groupByFile}, buttonGroup : groupBy, groupByFileAction)
radioButton(text : trans("SENDER"), selected : bind {!model.groupByFile}, buttonGroup : groupBy, groupBySenderAction)
radioButton(text : trans("FILE"), selected : bind {model.groupByFile}, buttonGroup : groupBy, groupByFileAction)
}
label(text : "Remember search history", constraints: gbc(gridx: 0, gridy:1, anchor : GridBagConstraints.LINE_START, weightx: 100))
label(text : trans("OPTIONS_REMEMBER_HISTORY"), constraints: gbc(gridx: 0, gridy:1, anchor : GridBagConstraints.LINE_START, weightx: 100))
storeSearchHistoryCheckbox = checkBox(selected : bind {model.storeSearchHistory},
constraints : gbc(gridx : 1, gridy:1, anchor : GridBagConstraints.LINE_END))
button(text : "Clear history", constraints : gbc(gridx : 1, gridy : 2, anchor : GridBagConstraints.LINE_END), clearHistoryAction)
button(text : trans("OPTIONS_CLEAR_HISTORY"), constraints : gbc(gridx : 1, gridy : 2, anchor : GridBagConstraints.LINE_END), clearHistoryAction)
}
panel (border : titledBorder(title : "Other Settings", border : etchedBorder(), titlePosition : TitledBorder.TOP),
panel (border : titledBorder(title : trans("OPTIONS_OTHER_SETTINGS"), border : etchedBorder(), titlePosition : TitledBorder.TOP),
constraints : gbc(gridx : 0, gridy : 2, fill : GridBagConstraints.HORIZONTAL, weightx : 100)) {
gridBagLayout()
label(text : "Automatically clear cancelled downloads", constraints: gbc(gridx: 0, gridy:0, anchor : GridBagConstraints.LINE_START, weightx: 100))
label(text : trans("OPTIONS_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))
label(text : trans("OPTIONS_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))
label(text : trans("OPTIONS_SMOOTH_DOWNLOAD_SPEED"), 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_END))
label(text : "Exclude local files from results", constraints: gbc(gridx:0, gridy:3, anchor : GridBagConstraints.LINE_START, weightx: 100))
label(text : trans("OPTIONS_EXCLUDE_LOCAL_FILES"), 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))
label(text : "Automatically clear finished uploads", constraints:gbc(gridx:0, gridy:4, anchor: GridBagConstraints.LINE_START, weightx : 100))
label(text : trans("OPTIONS_CLEAR_FINISHED_UPLOADS"), constraints:gbc(gridx:0, gridy:4, anchor: GridBagConstraints.LINE_START, weightx : 100))
clearUploadsCheckbox = checkBox(selected : bind {model.clearUploads},
constraints : gbc(gridx:1, gridy: 4, anchor:GridBagConstraints.LINE_END))
label(text : "When closing MuWire", constraints : gbc(gridx: 0, gridy : 5, anchor : GridBagConstraints.LINE_START, weightx: 100))
label(text : trans("OPTIONS_WHEN_CLOSING_MUWIRE"), constraints : gbc(gridx: 0, gridy : 5, anchor : GridBagConstraints.LINE_START, weightx: 100))
panel (constraints : gbc(gridx:1, gridy: 5, anchor : GridBagConstraints.LINE_END)) {
buttonGroup(id : "closeBehaviorGroup")
radioButton(text : "Minimize to tray", selected : bind {!model.exitOnClose}, buttonGroup: closeBehaviorGroup, minimizeOnCloseAction)
radioButton(text : "Exit", selected : bind {model.exitOnClose}, buttonGroup : closeBehaviorGroup, exitOnCloseAction)
radioButton(text : trans("OPTIONS_MINIMIZE_TO_TRAY"), selected : bind {!model.exitOnClose}, buttonGroup: closeBehaviorGroup, minimizeOnCloseAction)
radioButton(text : trans("EXIT"), selected : bind {model.exitOnClose}, buttonGroup : closeBehaviorGroup, exitOnCloseAction)
}
}
panel (constraints : gbc(gridx: 0, gridy: 3, weighty: 100))
}
bandwidth = builder.panel {
gridBagLayout()
panel( border : titledBorder(title : "Changing bandwidth settings requires a restart", border : etchedBorder(), titlePosition : TitledBorder.TOP),
panel( border : titledBorder(title : trans("OPTIONS_BANDWIDTH_SETTINGS"), border : etchedBorder(), titlePosition : TitledBorder.TOP),
constraints : gbc(gridx : 0, gridy : 0, fill : GridBagConstraints.HORIZONTAL, weightx : 100)) {
gridBagLayout()
label(text : "Inbound bandwidth (KB)", constraints : gbc(gridx: 0, gridy : 0, anchor : GridBagConstraints.LINE_START, weightx : 100))
label(text : trans("INBOUND_BANDWIDTH"), constraints : gbc(gridx: 0, gridy : 0, anchor : GridBagConstraints.LINE_START, weightx : 100))
inBwField = textField(text : bind {model.inBw}, columns : 3, constraints : gbc(gridx : 1, gridy : 0, anchor : GridBagConstraints.LINE_END))
label(text : "Outbound bandwidth (KB)", constraints : gbc(gridx: 0, gridy : 1, anchor : GridBagConstraints.LINE_START, weightx : 100))
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))
}
panel(constraints : gbc(gridx: 0, gridy: 1, weighty: 100))
}
feed = builder.panel {
gridBagLayout()
panel (border : titledBorder(title : "General Feed Settings", border : etchedBorder(), titlePosition : TitledBorder.TOP),
panel (border : titledBorder(title : trans("OPTIONS_FEED_SETTINGS"), border : etchedBorder(), titlePosition : TitledBorder.TOP),
constraints : gbc(gridx : 0, gridy : 0, fill : GridBagConstraints.HORIZONTAL, weightx: 100)) {
gridBagLayout()
label(text : "Enable file feed", constraints : gbc(gridx: 0, gridy : 0, anchor : GridBagConstraints.LINE_START, weightx: 100))
label(text : trans("OPTIONS_ENABLE_FEED"), constraints : gbc(gridx: 0, gridy : 0, anchor : GridBagConstraints.LINE_START, weightx: 100))
fileFeedCheckbox = checkBox(selected : bind {model.fileFeed}, constraints : gbc(gridx: 1, gridy : 0, anchor : GridBagConstraints.LINE_END))
label(text : "Advertise feed in search results", constraints : gbc(gridx: 0, gridy : 1, anchor : GridBagConstraints.LINE_START, weightx: 100))
label(text : trans("OPTIONS_ADVERTISE_FEED"), constraints : gbc(gridx: 0, gridy : 1, anchor : GridBagConstraints.LINE_START, weightx: 100))
advertiseFeedCheckbox = checkBox(selected : bind {model.advertiseFeed}, constraints : gbc(gridx: 1, gridy : 1, anchor : GridBagConstraints.LINE_END))
label(text : "Automatically publish shared files", constraints : gbc(gridx: 0, gridy : 2, anchor : GridBagConstraints.LINE_START, weightx: 100))
label(text : trans("OPTIONS_PUBLISH_SHARED"), constraints : gbc(gridx: 0, gridy : 2, anchor : GridBagConstraints.LINE_START, weightx: 100))
autoPublishSharedFilesCheckbox = checkBox(selected : bind {model.autoPublishSharedFiles}, constraints : gbc(gridx: 1, gridy : 2, anchor : GridBagConstraints.LINE_END))
}
panel (border : titledBorder(title : "Default Settings For New Feeds", border : etchedBorder(), titlePosition : TitledBorder.TOP),
panel (border : titledBorder(title : trans("OPTIONS_NEW_FEED_DEFAULTS"), border : etchedBorder(), titlePosition : TitledBorder.TOP),
constraints : gbc(gridx : 0, gridy : 1, fill : GridBagConstraints.HORIZONTAL, weightx: 100)) {
gridBagLayout()
label(text : "Automatically download files from feed", constraints : gbc(gridx: 0, gridy : 0, anchor : GridBagConstraints.LINE_START, weightx: 100))
label(text : trans("OPTIONS_FEED_AUTO_DOWNLOAD"), constraints : gbc(gridx: 0, gridy : 0, anchor : GridBagConstraints.LINE_START, weightx: 100))
defaultFeedAutoDownloadCheckbox = checkBox(selected : bind {model.defaultFeedAutoDownload}, constraints : gbc(gridx: 1, gridy : 0, anchor : GridBagConstraints.LINE_END))
label(text : "Download files from feed sequentially", constraints : gbc(gridx: 0, gridy : 1, anchor : GridBagConstraints.LINE_START, weightx: 100))
label(text : trans("OPTIONS_FEED_DOWNLOAD_SEQUENTIALLY"), constraints : gbc(gridx: 0, gridy : 1, anchor : GridBagConstraints.LINE_START, weightx: 100))
defaultFeedSequentialCheckbox = checkBox(selected : bind {model.defaultFeedSequential}, constraints : gbc(gridx: 1, gridy : 1, anchor : GridBagConstraints.LINE_END))
label(text : "Feed items to store on disk (-1 means unlimited)", constraints : gbc(gridx: 0, gridy : 2, anchor : GridBagConstraints.LINE_START, weightx: 100))
label(text : trans("OPTIONS_FEED_ITEMS_ON_DISK"), constraints : gbc(gridx: 0, gridy : 2, anchor : GridBagConstraints.LINE_START, weightx: 100))
defaultFeedItemsToKeepField = textField(text : bind {model.defaultFeedItemsToKeep}, constraints:gbc(gridx :1, gridy:2, anchor : GridBagConstraints.LINE_END))
label(text : "Feed refresh frequency in minutes", constraints : gbc(gridx: 0, gridy : 3, anchor : GridBagConstraints.LINE_START, weightx: 100))
label(text : trans("OPTIONS_FEED_REFRESH_FREQUENCY"), constraints : gbc(gridx: 0, gridy : 3, anchor : GridBagConstraints.LINE_START, weightx: 100))
defaultFeedUpdateIntervalField = textField(text : bind {model.defaultFeedUpdateInterval}, constraints:gbc(gridx :1, gridy:3, anchor : GridBagConstraints.LINE_END))
}
panel(constraints : gbc(gridx: 0, gridy : 2, weighty: 100))
}
trust = builder.panel {
gridBagLayout()
panel (border : titledBorder(title : "Trust Settings", border : etchedBorder(), titlePosition : TitledBorder.TOP),
panel (border : titledBorder(title : trans("OPTIONS_TRUST_SETTINGS"), border : etchedBorder(), titlePosition : TitledBorder.TOP),
constraints : gbc(gridx : 0, gridy : 0, fill : GridBagConstraints.HORIZONTAL, weightx: 100)) {
gridBagLayout()
label(text : "Allow only trusted connections", constraints : gbc(gridx: 0, gridy : 0, anchor : GridBagConstraints.LINE_START, weightx: 100))
label(text : trans("OPTIONS_ONLY_TRUSTED"), constraints : gbc(gridx: 0, gridy : 0, anchor : GridBagConstraints.LINE_START, weightx: 100))
allowUntrustedCheckbox = checkBox(selected : bind {model.onlyTrusted}, constraints : gbc(gridx: 1, gridy : 0, anchor : GridBagConstraints.LINE_END))
label(text : "Search extra hop", constraints : gbc(gridx:0, gridy:1, anchor : GridBagConstraints.LINE_START, weightx : 100))
label(text : trans("OPTIONS_SEARCH_EXTRA_HOP"), constraints : gbc(gridx:0, gridy:1, anchor : GridBagConstraints.LINE_START, weightx : 100))
searchExtraHopCheckbox = checkBox(selected : bind {model.searchExtraHop}, constraints : gbc(gridx: 1, gridy : 1, anchor : GridBagConstraints.LINE_END))
label(text : "Allow others to view my trust list", constraints : gbc(gridx: 0, gridy : 2, anchor : GridBagConstraints.LINE_START, weightx : 100))
label(text : trans("OPTIONS_ALLOW_TRUST_LIST"), constraints : gbc(gridx: 0, gridy : 2, anchor : GridBagConstraints.LINE_START, weightx : 100))
allowTrustListsCheckbox = checkBox(selected : bind {model.trustLists}, constraints : gbc(gridx: 1, gridy : 2, anchor : GridBagConstraints.LINE_END))
label(text : "Update trust lists every (hours)", constraints : gbc(gridx:0, gridy:3, anchor : GridBagConstraints.LINE_START, weightx : 100))
label(text : trans("OPTIONS_TRUST_LIST_UPDATE_INTERVAL"), constraints : gbc(gridx:0, gridy:3, anchor : GridBagConstraints.LINE_START, weightx : 100))
trustListIntervalField = textField(text : bind {model.trustListInterval}, constraints:gbc(gridx:1, gridy:3, anchor : GridBagConstraints.LINE_END))
}
panel(constraints : gbc(gridx: 0, gridy : 1, weighty: 100))
@ -338,20 +339,20 @@ class OptionsView {
chat = builder.panel {
gridBagLayout()
panel (border : titledBorder(title : "Chat Settings", border : etchedBorder(), titlePosition : TitledBorder.TOP),
panel (border : titledBorder(title : trans("OPTIONS_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))
label(text : trans("OPTIONS_START_CHAT_SERVER_STARTUP"), constraints : gbc(gridx: 0, gridy: 0, anchor: GridBagConstraints.LINE_START, weightx: 100))
startChatServerCheckbox = checkBox(selected : bind{model.startChatServer}, constraints : gbc(gridx:2, 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))
label(text : trans("OPTIONS_MAX_CHAT_CONNECTIONS"), constraints : gbc(gridx: 0, gridy:1, anchor:GridBagConstraints.LINE_START, weightx:100))
maxChatConnectionsField = textField(text : bind {model.maxChatConnections}, constraints : gbc(gridx: 2, 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))
label(text : trans("OPTIONS_ADVERTISE_CHAT"), constraints : gbc(gridx: 0, gridy:2, anchor:GridBagConstraints.LINE_START, weightx:100))
advertiseChatCheckbox = checkBox(selected : bind{model.advertiseChat}, constraints : gbc(gridx:2, gridy:2, anchor:GridBagConstraints.LINE_END))
label(text : "Maximum lines of scrollback (-1 means unlimited)", constraints : gbc(gridx:0, gridy:3, anchor : GridBagConstraints.LINE_START, weightx: 100))
label(text : trans("OPTIONS_MAX_CHAT_SCROLLBACK"), constraints : gbc(gridx:0, gridy:3, anchor : GridBagConstraints.LINE_START, weightx: 100))
maxChatLinesField = textField(text : bind{model.maxChatLines}, constraints : gbc(gridx:2, gridy: 3, anchor: GridBagConstraints.LINE_END))
label(text : "Welcome message file", constraints : gbc(gridx : 0, gridy : 4, anchor : GridBagConstraints.LINE_START, weightx: 100))
label(text : trans("OPTIONS_CHAT_WELCOME_FILE"), constraints : gbc(gridx : 0, gridy : 4, anchor : GridBagConstraints.LINE_START, weightx: 100))
label(text : bind {model.chatWelcomeFile}, constraints : gbc(gridx : 1, gridy : 4))
button(text : "Choose", constraints : gbc(gridx : 2, gridy : 4, anchor : GridBagConstraints.LINE_END), chooseChatFileAction)
button(text : trans("CHOOSE"), constraints : gbc(gridx : 2, gridy : 4, anchor : GridBagConstraints.LINE_END), chooseChatFileAction)
}
panel(constraints : gbc(gridx: 0, gridy : 1, weighty: 100))
}
@ -359,8 +360,8 @@ class OptionsView {
buttonsPanel = builder.panel {
gridBagLayout()
button(text : "Save", constraints : gbc(gridx : 1, gridy: 2), saveAction)
button(text : "Cancel", constraints : gbc(gridx : 2, gridy: 2), cancelAction)
button(text : trans("SAVE"), constraints : gbc(gridx : 1, gridy: 2), saveAction)
button(text : trans("CANCEL"), constraints : gbc(gridx : 2, gridy: 2), cancelAction)
}
}
@ -368,14 +369,14 @@ class OptionsView {
def tabbedPane = new JTabbedPane()
tabbedPane.addTab("MuWire", p)
tabbedPane.addTab("I2P", i)
tabbedPane.addTab("GUI", u)
tabbedPane.addTab(trans("GUI"), u)
Core core = application.context.get("core")
if (core.router != null) {
tabbedPane.addTab("Bandwidth", bandwidth)
tabbedPane.addTab(trans("BANDWIDTH"), bandwidth)
}
tabbedPane.addTab("Feed", feed)
tabbedPane.addTab("Trust", trust)
tabbedPane.addTab("Chat", chat)
tabbedPane.addTab(trans("FEED"), feed)
tabbedPane.addTab(trans("TRUST"), trust)
tabbedPane.addTab(trans("CHAT"), chat)
JPanel panel = new JPanel()
panel.setLayout(new BorderLayout())