Lay out the Options dialog like TeamSpeak 3's

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>
This commit is contained in:
2026-10-01 17:07:13 +00:00
co-authored by Claude Opus 5.5
parent 0ad56671af
commit e06bb82299
19 changed files with 903 additions and 505 deletions
@@ -5,7 +5,6 @@ import com.formdev.flatlaf.util.UIScale;
import com.ts3client.config.Settings;
import com.ts3client.gfx.IconPack;
import javax.swing.BorderFactory;
import javax.swing.DefaultListCellRenderer;
import javax.swing.DefaultListModel;
import javax.swing.ImageIcon;
@@ -50,9 +49,10 @@ final class DesignPanel extends JPanel {
private static final double[] SCALES = {0, 1, 1.25, 1.5, 1.75, 2, 2.5, 3};
private final Settings settings;
private final String originalPackId;
private final String originalPackDir;
private final Settings.Appearance originalAppearance;
/** What {@link #revert()} goes back to: as the dialog opened, or as last applied. */
private String originalPackId;
private String originalPackDir;
private Settings.Appearance originalAppearance;
private final JComboBox<Settings.Appearance> appearanceCombo =
new JComboBox<>(Settings.Appearance.values());
@@ -87,9 +87,12 @@ final class DesignPanel extends JPanel {
Object selected = packCombo.getSelectedItem();
settings.iconPack = selected instanceof IconPack pack ? pack.id() : "";
settings.countryFlags = countryFlags.isSelected();
originalPackId = settings.iconPack;
originalPackDir = settings.iconPackDir;
originalAppearance = settings.appearance;
}
/** Puts back the appearance and pack the dialog started with, for a cancelled edit. */
/** Puts back the appearance and pack last applied, for a cancelled edit. */
void revert() {
settings.iconPack = originalPackId;
settings.iconPackDir = originalPackDir;
@@ -105,7 +108,7 @@ final class DesignPanel extends JPanel {
private JComponent buildHeader() {
JPanel p = new JPanel(new GridBagLayout());
GridBagConstraints c = new GridBagConstraints();
c.insets = UIScale.scale(new Insets(2, 2, 2, 2));
c.insets = UIScale.scale(new Insets(4, 4, 4, 4));
c.anchor = GridBagConstraints.WEST;
c.fill = GridBagConstraints.HORIZONTAL;
@@ -134,30 +137,30 @@ final class DesignPanel extends JPanel {
});
appearanceCombo.addActionListener(e -> onAppearanceSelected());
int row = 0;
addRow(p, c, row++, new JLabel("Theme:"), appearanceCombo);
if (DisplayScale.isManaged()) {
buildScaleCombo();
addRow(p, c, row++, new JLabel("Interface scale:"), scaleCombo);
}
addRow(p, c, row++, new JLabel("Icon pack:"), packCombo);
c.gridx = 1;
c.gridy = row++;
packInfo.setEnabled(false);
p.add(packInfo, c);
JPanel dirRow = new JPanel(new BorderLayout(UIScale.scale(6), 0));
JButton browse = new JButton("Browse…");
browse.addActionListener(e -> browseForPackFolder());
dirRow.add(packDirField, BorderLayout.CENTER);
dirRow.add(browse, BorderLayout.EAST);
packDirField.setToolTipText("Extra folder to look for icon packs in");
addRow(p, c, row++, new JLabel("Extra pack folder:"), dirRow);
packInfo.setEnabled(false);
countryFlags.setSelected(settings.countryFlags);
int row = 0;
FormPanel.addSection(p, c, row++, "Appearance");
FormPanel.addRow(p, c, row++, new JLabel("Theme:"), appearanceCombo);
if (DisplayScale.isManaged()) {
buildScaleCombo();
FormPanel.addRow(p, c, row++, new JLabel("Interface scale:"), scaleCombo);
}
FormPanel.addSection(p, c, row++, "Channel Tree");
FormPanel.addWide(p, c, row++, countryFlags);
FormPanel.addSection(p, c, row++, "Icon Pack");
FormPanel.addRow(p, c, row++, new JLabel("Icon pack:"), packCombo);
c.gridx = 1;
c.gridy = row;
p.add(countryFlags, c);
c.gridy = row++;
p.add(packInfo, c);
FormPanel.addRow(p, c, row, new JLabel("Extra pack folder:"), dirRow);
return p;
}
@@ -207,7 +210,6 @@ final class DesignPanel extends JPanel {
JScrollPane scroll = new JScrollPane(preview);
scroll.setPreferredSize(UIScale.scale(new Dimension(360, 200)));
scroll.setBorder(BorderFactory.createTitledBorder("Icons in this pack"));
return scroll;
}
@@ -265,14 +267,4 @@ final class DesignPanel extends JPanel {
settings.iconPackDir = packDirField.getText();
reloadPacks();
}
private static void addRow(JPanel p, GridBagConstraints c, int row, JLabel label, Component field) {
c.gridx = 0;
c.gridy = row;
c.weightx = 0;
p.add(label, c);
c.gridx = 1;
c.weightx = 1;
p.add(field, c);
}
}