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:
@@ -0,0 +1,39 @@
|
||||
package com.ts3client.ui;
|
||||
|
||||
import com.ts3client.audio.AudioDevice;
|
||||
|
||||
import javax.swing.JComboBox;
|
||||
import java.util.List;
|
||||
|
||||
/** The device pickers of the Playback and Capture pages. */
|
||||
final class AudioDevices {
|
||||
|
||||
private static final String HINT = "<html>Named devices are PipeWire's, and are routed through it "
|
||||
+ "(so per-application volume and rerouting keep working).<br>"
|
||||
+ "<b>ALSA:</b> entries talk to the sound card directly, taking it exclusively.</html>";
|
||||
|
||||
private AudioDevices() {
|
||||
}
|
||||
|
||||
/** A picker over {@code devices} with {@code selectedId} chosen, or the first (default) one. */
|
||||
static JComboBox<AudioDevice> combo(List<AudioDevice> devices, String selectedId) {
|
||||
JComboBox<AudioDevice> combo = new JComboBox<>(devices.toArray(new AudioDevice[0]));
|
||||
combo.setToolTipText(HINT);
|
||||
if (combo.getItemCount() == 0) return combo;
|
||||
combo.setSelectedIndex(0);
|
||||
if (selectedId != null && !selectedId.isEmpty()) {
|
||||
for (int i = 0; i < combo.getItemCount(); i++) {
|
||||
if (selectedId.equals(combo.getItemAt(i).id())) {
|
||||
combo.setSelectedIndex(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return combo;
|
||||
}
|
||||
|
||||
static String selectedId(JComboBox<AudioDevice> combo) {
|
||||
AudioDevice d = (AudioDevice) combo.getSelectedItem();
|
||||
return d == null ? "" : d.id();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user