A sidebar of pages with large icons replaces the tabs, and each page opens under a banner with its title, subtitle and icon. OK, Cancel and Apply sit below, and the dialog reopens on the last page used. The pages follow TS3's: Application (muted-microphone warning, reported client version), myTeamSpeak, Playback, Capture, Design, Hotkeys, Contacts, Chat and Notifications. Capture now holds everything from the microphone to the server: the device and gain, activation with the microphone test, signal processing and the encoder, laid out in one grid so its columns line up. Forms are grouped under section headings. Cancel now goes back to what was last applied, and closing the window cancels too, so a theme or icon pack being tried out is put back. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
75 lines
3.3 KiB
Java
75 lines
3.3 KiB
Java
package com.ts3client.ui;
|
|
|
|
import com.ts3client.config.Settings;
|
|
|
|
import javax.swing.DefaultListCellRenderer;
|
|
import javax.swing.JButton;
|
|
import javax.swing.JCheckBox;
|
|
import javax.swing.JComboBox;
|
|
import javax.swing.JDialog;
|
|
import javax.swing.JLabel;
|
|
import javax.swing.JList;
|
|
import javax.swing.JPanel;
|
|
import javax.swing.SwingUtilities;
|
|
import java.awt.Component;
|
|
import java.awt.FlowLayout;
|
|
import java.awt.GridBagConstraints;
|
|
|
|
/**
|
|
* Options page for the contact list: whether friends and blocked clients are
|
|
* coloured in the server tree, whose whispers get through (TeamSpeak's whisper
|
|
* options), and the defaults a new contact starts with.
|
|
*/
|
|
final class ContactsPanel extends FormPanel {
|
|
|
|
private final Settings settings;
|
|
private final JCheckBox colorContacts = new JCheckBox("Colour friends and blocked clients in the server tree");
|
|
private final JComboBox<Settings.WhisperPolicy> whisperPolicy = new JComboBox<>(Settings.WhisperPolicy.values());
|
|
|
|
ContactsPanel(Settings settings) {
|
|
this.settings = settings;
|
|
GridBagConstraints c = gbc();
|
|
|
|
colorContacts.setSelected(settings.colorContacts);
|
|
colorContacts.setToolTipText("Friends in green and blocked clients in red, as the TeamSpeak client shows them");
|
|
|
|
whisperPolicy.setSelectedItem(settings.whisperPolicy);
|
|
whisperPolicy.setRenderer(new DefaultListCellRenderer() {
|
|
@Override
|
|
public Component getListCellRendererComponent(JList<?> list, Object value, int index,
|
|
boolean selected, boolean focus) {
|
|
super.getListCellRendererComponent(list, value, index, selected, focus);
|
|
if (value instanceof Settings.WhisperPolicy) setText(((Settings.WhisperPolicy) value).label());
|
|
return this;
|
|
}
|
|
});
|
|
whisperPolicy.setToolTipText("<html>Use individual settings in contacts, else allow: a client not on your "
|
|
+ "contact list may whisper to you.<br>Use individual settings in contacts, else deny: only "
|
|
+ "contacts marked \"Allow whisper\" may.<br>Nobody: individual contact settings are ignored.</html>");
|
|
|
|
JButton defaults = new JButton("Contact defaults…");
|
|
defaults.setToolTipText("Configure default settings when adding a client to the Contact Manager");
|
|
defaults.addActionListener(e -> {
|
|
java.awt.Window owner = SwingUtilities.getWindowAncestor(this);
|
|
new ContactDefaultsDialog(owner instanceof JDialog ? (JDialog) owner : null, settings).setVisible(true);
|
|
});
|
|
JPanel defaultsRow = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0));
|
|
defaultsRow.add(defaults);
|
|
|
|
int row = 0;
|
|
addSection(this, c, row++, "Server Tree");
|
|
addWide(this, c, row++, colorContacts);
|
|
addSection(this, c, row++, "Whispers");
|
|
addRow(this, c, row++, new JLabel("Allow whispers from:"), whisperPolicy);
|
|
addSection(this, c, row++, "New Contacts");
|
|
addWide(this, c, row++, defaultsRow);
|
|
addFiller(this, c, row);
|
|
}
|
|
|
|
/** Copies the page into the settings; the caller saves them. */
|
|
void apply() {
|
|
settings.colorContacts = colorContacts.isSelected();
|
|
settings.whisperPolicy = (Settings.WhisperPolicy) whisperPolicy.getSelectedItem();
|
|
}
|
|
}
|