mirror of https://github.com/zlatinb/muwire
options to not display avatars or user ids
parent
f5bbd30c58
commit
6b441d6ff9
|
@ -341,6 +341,14 @@ class OptionsController {
|
|||
if (model.closeDecisionMade)
|
||||
uiSettings.closeWarning = false
|
||||
}
|
||||
|
||||
boolean personaRendererAvatars = view.personaRendererAvatarsCheckbox.model.isSelected()
|
||||
model.personaRendererAvatars = personaRendererAvatars
|
||||
uiSettings.personaRendererAvatars = personaRendererAvatars
|
||||
|
||||
boolean personaRendererIds = view.personaRendererIdsCheckbox.model.isSelected()
|
||||
model.personaRendererIds = personaRendererIds
|
||||
uiSettings.personaRendererIds = personaRendererIds
|
||||
|
||||
saveUISettings()
|
||||
|
||||
|
|
|
@ -364,6 +364,9 @@ OPTIONS_EXCLUDE_LOCAL_FILES=Exclude 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
|
||||
OPTIONS_PERSONA_RENDERING=User Name Display Options
|
||||
OPTIONS_PERSONA_RENDERING_AVATARS=Show avatars
|
||||
OPTIONS_PERSONA_RENDERING_IDS=Show IDs
|
||||
|
||||
# Bandwidth tab
|
||||
OPTIONS_BANDWIDTH_SETTINGS=Changing bandwidth settings requires a restart
|
||||
|
|
|
@ -100,6 +100,10 @@ class OptionsModel {
|
|||
@Observable boolean allowOnlyTrustedMessages
|
||||
@Observable int messageSendInterval
|
||||
|
||||
// persona rendering options
|
||||
@Observable boolean personaRendererAvatars
|
||||
@Observable boolean personaRendererIds
|
||||
|
||||
boolean disableUpdates
|
||||
|
||||
void mvcGroupInit(Map<String, String> args) {
|
||||
|
@ -155,6 +159,8 @@ class OptionsModel {
|
|||
groupByFile = uiSettings.groupByFile
|
||||
messageNotifications = uiSettings.messageNotifications
|
||||
showUnsharedPaths = uiSettings.showUnsharedPaths
|
||||
personaRendererAvatars = uiSettings.personaRendererAvatars
|
||||
personaRendererIds = uiSettings.personaRendererIds
|
||||
|
||||
if (System.getProperty("embeddedRouter") == "true") {
|
||||
inBw = String.valueOf(settings.inBw)
|
||||
|
|
|
@ -3,7 +3,11 @@ package com.muwire.gui
|
|||
import com.muwire.gui.profile.PersonaOrProfile
|
||||
import com.muwire.gui.profile.PersonaOrProfileCellRenderer
|
||||
import com.muwire.gui.profile.PersonaOrProfileComparator
|
||||
import griffon.core.GriffonApplication
|
||||
import griffon.core.artifact.GriffonView
|
||||
|
||||
import javax.inject.Inject
|
||||
|
||||
import static com.muwire.gui.Translator.trans
|
||||
import griffon.inject.MVCMember
|
||||
import griffon.metadata.ArtifactProviderFor
|
||||
|
@ -40,6 +44,8 @@ class ChatRoomView {
|
|||
ChatRoomModel model
|
||||
@MVCMember @Nonnull
|
||||
ChatRoomController controller
|
||||
@Inject
|
||||
GriffonApplication application
|
||||
|
||||
ChatNotificator chatNotificator
|
||||
|
||||
|
@ -128,7 +134,7 @@ class ChatRoomView {
|
|||
|
||||
if (membersTable != null) {
|
||||
|
||||
membersTable.setDefaultRenderer(PersonaOrProfile.class, new PersonaOrProfileCellRenderer())
|
||||
membersTable.setDefaultRenderer(PersonaOrProfile.class, new PersonaOrProfileCellRenderer(application.context.get("ui-settings")))
|
||||
membersTable.rowSorter.setComparator(0, new PersonaOrProfileComparator())
|
||||
membersTable.rowSorter.addRowSorterListener({evt -> lastMembersTableSortEvent = evt})
|
||||
membersTable.rowSorter.setSortsOnUpdates(true)
|
||||
|
|
|
@ -891,7 +891,7 @@ class MainFrameView {
|
|||
WHEN_IN_FOCUSED_WINDOW)
|
||||
}
|
||||
|
||||
def popRenderer = new PersonaOrProfileCellRenderer()
|
||||
def popRenderer = new PersonaOrProfileCellRenderer(application.context.get("ui-settings"))
|
||||
def popComparator = new PersonaOrProfileComparator()
|
||||
|
||||
// downloads table
|
||||
|
|
|
@ -196,7 +196,8 @@ class MessageFolderView {
|
|||
def centerRenderer = new DefaultTableCellRenderer()
|
||||
centerRenderer.setHorizontalAlignment(JLabel.CENTER)
|
||||
|
||||
messageHeaderTable.setDefaultRenderer(PersonaOrProfile.class, new PersonaOrProfileCellRenderer())
|
||||
messageHeaderTable.setDefaultRenderer(PersonaOrProfile.class,
|
||||
new PersonaOrProfileCellRenderer(application.context.get("ui-settings")))
|
||||
messageHeaderTable.setDefaultRenderer(Integer.class, centerRenderer)
|
||||
messageHeaderTable.setDefaultRenderer(Long.class, new DateRenderer())
|
||||
if (!model.outgoing)
|
||||
|
|
|
@ -92,6 +92,8 @@ class OptionsView {
|
|||
def showUnsharedPathsCheckbox
|
||||
def storeSearchHistoryCheckbox
|
||||
def messageNotificationsCheckbox
|
||||
def personaRendererAvatarsCheckbox
|
||||
def personaRendererIdsCheckbox
|
||||
|
||||
def inBwField
|
||||
def outBwField
|
||||
|
@ -442,7 +444,17 @@ class OptionsView {
|
|||
}
|
||||
}
|
||||
}
|
||||
panel (constraints : gbc(gridx: 0, gridy: 3, weighty: 100))
|
||||
panel (border : titledBorder(title : trans("OPTIONS_PERSONA_RENDERING"), border : etchedBorder(), titlePosition : TitledBorder.TOP),
|
||||
constraints : gbc(gridx : 0, gridy : 3, fill : GridBagConstraints.HORIZONTAL, weightx : 100)) {
|
||||
gridBagLayout()
|
||||
label(text: trans("OPTIONS_PERSONA_RENDERING_AVATARS"), constraints: gbc(gridx: 0, gridy: 0, anchor: GridBagConstraints.LINE_START, weightx: 100))
|
||||
personaRendererAvatarsCheckbox = checkBox(selected: bind {model.personaRendererAvatars},
|
||||
constraints: gbc(gridx:1, gridy:0, anchor: GridBagConstraints.LINE_END))
|
||||
label(text: trans("OPTIONS_PERSONA_RENDERING_IDS"), constraints: gbc(gridx: 0, gridy: 1, anchor: GridBagConstraints.LINE_START, weightx: 100))
|
||||
personaRendererIdsCheckbox = checkBox(selected: bind {model.personaRendererIds},
|
||||
constraints: gbc(gridx:1, gridy:1, anchor: GridBagConstraints.LINE_END))
|
||||
}
|
||||
panel (constraints : gbc(gridx: 0, gridy: 4, weighty: 100))
|
||||
}
|
||||
bandwidth = builder.panel {
|
||||
gridBagLayout()
|
||||
|
|
|
@ -6,9 +6,11 @@ import com.muwire.gui.profile.PersonaOrProfile
|
|||
import com.muwire.gui.profile.PersonaOrProfileCellRenderer
|
||||
import com.muwire.gui.profile.PersonaOrProfileComparator
|
||||
import com.muwire.gui.profile.ResultPOP
|
||||
import griffon.core.GriffonApplication
|
||||
import griffon.core.artifact.GriffonView
|
||||
import net.i2p.data.Destination
|
||||
|
||||
import javax.inject.Inject
|
||||
import javax.swing.AbstractAction
|
||||
import javax.swing.Action
|
||||
import javax.swing.JPanel
|
||||
|
@ -64,6 +66,8 @@ class SearchTabView {
|
|||
SearchTabModel model
|
||||
@MVCMember @Nonnull
|
||||
SearchTabController controller
|
||||
@Inject
|
||||
GriffonApplication application
|
||||
|
||||
UISettings settings
|
||||
|
||||
|
@ -397,7 +401,7 @@ class SearchTabView {
|
|||
})
|
||||
|
||||
// senders table
|
||||
def popRenderer = new PersonaOrProfileCellRenderer()
|
||||
def popRenderer = new PersonaOrProfileCellRenderer(application.context.get("ui-settings"))
|
||||
def popComparator = new PersonaOrProfileComparator()
|
||||
sendersTable.addMouseListener(sendersMouseListener)
|
||||
sendersTable.setDefaultRenderer(Integer.class, centerRenderer)
|
||||
|
|
|
@ -4,10 +4,12 @@ import com.muwire.core.Persona
|
|||
import com.muwire.gui.profile.PersonaOrProfile
|
||||
import com.muwire.gui.profile.PersonaOrProfileCellRenderer
|
||||
import com.muwire.gui.profile.PersonaOrProfileComparator
|
||||
import griffon.core.GriffonApplication
|
||||
import griffon.core.artifact.GriffonView
|
||||
import griffon.inject.MVCMember
|
||||
import griffon.metadata.ArtifactProviderFor
|
||||
|
||||
import javax.inject.Inject
|
||||
import javax.swing.JFrame
|
||||
import javax.swing.JTable
|
||||
import java.awt.Dimension
|
||||
|
@ -29,6 +31,8 @@ class TrustListView {
|
|||
FactoryBuilderSupport builder
|
||||
@MVCMember @Nonnull
|
||||
TrustListModel model
|
||||
@Inject
|
||||
GriffonApplication application
|
||||
|
||||
JFrame window
|
||||
JFrame mainFrame
|
||||
|
@ -83,7 +87,7 @@ class TrustListView {
|
|||
|
||||
void mvcGroupInit(Map<String,String> args) {
|
||||
|
||||
def popRenderer = new PersonaOrProfileCellRenderer()
|
||||
def popRenderer = new PersonaOrProfileCellRenderer(application.context.get("ui-settings"))
|
||||
def popComparator = new PersonaOrProfileComparator()
|
||||
|
||||
contactsTable.setDefaultRenderer(PersonaOrProfile.class, popRenderer)
|
||||
|
|
|
@ -126,7 +126,8 @@ class ResultDetailsFrameView {
|
|||
void mvcGroupInit(Map<String, String> args) {
|
||||
if (model.senders.size() > 1) {
|
||||
JTable sendersTable = builder.getVariable("senders-table")
|
||||
sendersTable.setDefaultRenderer(PersonaOrProfile.class, new PersonaOrProfileCellRenderer())
|
||||
sendersTable.setDefaultRenderer(PersonaOrProfile.class,
|
||||
new PersonaOrProfileCellRenderer(application.context.get("ui-settings")))
|
||||
sendersTable.rowSorter.setComparator(0, new PersonaOrProfileComparator())
|
||||
}
|
||||
if (certificatesPanel != null) {
|
||||
|
|
|
@ -11,6 +11,7 @@ import com.muwire.gui.profile.PersonaOrProfileComparator
|
|||
import com.muwire.gui.profile.ResultPOP
|
||||
import com.muwire.gui.profile.ThumbnailIcon
|
||||
import com.muwire.gui.resultdetails.ResultListCellRenderer
|
||||
import griffon.core.GriffonApplication
|
||||
import griffon.core.artifact.GriffonView
|
||||
import griffon.core.mvc.MVCGroup
|
||||
import griffon.inject.MVCMember
|
||||
|
@ -18,6 +19,7 @@ import griffon.metadata.ArtifactProviderFor
|
|||
import net.i2p.data.Base64
|
||||
|
||||
import javax.annotation.Nonnull
|
||||
import javax.inject.Inject
|
||||
import javax.swing.Icon
|
||||
import javax.swing.JList
|
||||
import javax.swing.JPanel
|
||||
|
@ -36,6 +38,8 @@ class ResultDetailsTabsView {
|
|||
FactoryBuilderSupport builder
|
||||
@MVCMember @Nonnull
|
||||
ResultDetailsTabsModel model
|
||||
@Inject
|
||||
GriffonApplication application
|
||||
|
||||
|
||||
JPanel p
|
||||
|
@ -182,7 +186,8 @@ class ResultDetailsTabsView {
|
|||
void mvcGroupInit(Map<String,String> args) {
|
||||
|
||||
// all senders table
|
||||
sendersTable.setDefaultRenderer(PersonaOrProfile.class, new PersonaOrProfileCellRenderer())
|
||||
sendersTable.setDefaultRenderer(PersonaOrProfile.class,
|
||||
new PersonaOrProfileCellRenderer(application.context.get("ui-settings")))
|
||||
sendersTable.rowSorter.setComparator(0, new PersonaOrProfileComparator())
|
||||
def selectionModel = sendersTable.getSelectionModel()
|
||||
selectionModel.setSelectionMode(ListSelectionModel.SINGLE_SELECTION)
|
||||
|
|
|
@ -33,6 +33,10 @@ class UISettings {
|
|||
Set<String> openTabs
|
||||
boolean messageNotifications
|
||||
|
||||
// persona renderer settings
|
||||
boolean personaRendererAvatars
|
||||
boolean personaRendererIds
|
||||
|
||||
UISettings(Properties props) {
|
||||
lnf = props.getProperty("lnf", "system")
|
||||
locale = props.getProperty("locale","us")
|
||||
|
@ -63,6 +67,9 @@ class UISettings {
|
|||
messageNotifications = Boolean.parseBoolean(props.getProperty("messageNotifications","true"))
|
||||
|
||||
showUnsharedPaths = Boolean.parseBoolean(props.getProperty("showUnsharedPaths","false"))
|
||||
|
||||
personaRendererAvatars = Boolean.parseBoolean(props.getProperty("personaRendererAvatars", "true"))
|
||||
personaRendererIds = Boolean.parseBoolean(props.getProperty("personaRendererIds", "true"))
|
||||
}
|
||||
|
||||
void write(OutputStream out) throws IOException {
|
||||
|
@ -97,6 +104,9 @@ class UISettings {
|
|||
props.setProperty("messageNotifications", String.valueOf(messageNotifications))
|
||||
|
||||
props.setProperty("showUnsharedPaths", String.valueOf(showUnsharedPaths))
|
||||
|
||||
props.setProperty("personaRendererAvatars", String.valueOf(personaRendererAvatars))
|
||||
props.setProperty("personaRendererIds", String.valueOf(personaRendererIds))
|
||||
|
||||
props.store(out, "UI Properties")
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.muwire.gui.profile
|
||||
|
||||
import com.muwire.core.Persona
|
||||
import com.muwire.gui.UISettings
|
||||
|
||||
import javax.swing.JTable
|
||||
import javax.swing.table.DefaultTableCellRenderer
|
||||
|
@ -9,13 +10,20 @@ import java.awt.Component
|
|||
import static com.muwire.gui.Translator.trans
|
||||
|
||||
class PersonaOrProfileCellRenderer extends DefaultTableCellRenderer {
|
||||
|
||||
private final UISettings settings
|
||||
|
||||
PersonaOrProfileCellRenderer(UISettings settings) {
|
||||
this.settings = settings
|
||||
}
|
||||
|
||||
@Override
|
||||
Component getTableCellRendererComponent(JTable table, Object value,
|
||||
boolean isSelected, boolean hasFocus, int row, int column) {
|
||||
super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column)
|
||||
|
||||
PersonaOrProfile pop = (PersonaOrProfile) value
|
||||
if (pop.getThumbnail() != null)
|
||||
if (pop.getThumbnail() != null && settings.personaRendererAvatars)
|
||||
setIcon(pop.getThumbnail())
|
||||
else
|
||||
setIcon(null)
|
||||
|
@ -26,7 +34,14 @@ class PersonaOrProfileCellRenderer extends DefaultTableCellRenderer {
|
|||
setToolTipText(trans("NO_PROFILE"))
|
||||
|
||||
Persona persona = pop.getPersona()
|
||||
setText("<html>${htmlize(persona)}</html>")
|
||||
if (settings.personaRendererIds)
|
||||
setText("<html>${htmlize(persona)}</html>")
|
||||
else {
|
||||
String fullName = pop.getPersona().getHumanReadableName()
|
||||
String justName = fullName.substring(0, fullName.indexOf("@"))
|
||||
setText(justName)
|
||||
}
|
||||
|
||||
if (isSelected) {
|
||||
setForeground(table.getSelectionForeground())
|
||||
setBackground(table.getSelectionBackground())
|
||||
|
|
Loading…
Reference in New Issue