Show servers' icons on bookmarks, and their host button in the toolbar's corner

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-01 22:28:35 +00:00
parent cf1db61a4a
commit 2c1b37ee30
20 changed files with 419 additions and 30 deletions

View File

@@ -3,6 +3,8 @@ package com.ts3client.ui;
import com.formdev.flatlaf.util.ScaledEmptyBorder;
import com.formdev.flatlaf.util.UIScale;
import com.ts3client.config.Settings;
import com.ts3client.net.HostButton;
import com.ts3client.net.PictureDownloads;
import javax.swing.Box;
import javax.swing.JButton;
@@ -22,10 +24,10 @@ import java.awt.FlowLayout;
/**
* The main window's toolbar: connect/disconnect, the per-tab mic/speaker/away
* controls, and the Master Volume slider on the right. A right-click anywhere on
* the bar opens a customization menu for the window's optional chrome (this
* toolbar has no say over the status bar's own visibility beyond reporting the
* toggle).
* controls, and the Master Volume slider and the server's host button on the
* right. A right-click anywhere on the bar opens a customization menu for the
* window's optional chrome (this toolbar has no say over the status bar's own
* visibility beyond reporting the toggle).
*
* <p>Talks to {@link MainFrame} only through {@link Listener}, so it owns no
* connection/tab state itself &mdash; {@link #refresh} is handed everything it
@@ -68,8 +70,9 @@ final class MainToolbar extends JToolBar {
private final JToggleButton speakerButton;
private final DropDownToggleButton awayButton;
private final JComponent masterVolumePanel;
private final HostButtonView hostButton;
MainToolbar(Settings settings, Listener listener) {
MainToolbar(Settings settings, Listener listener, PictureDownloads pictures) {
this.settings = settings;
this.listener = listener;
@@ -120,6 +123,13 @@ final class MainToolbar extends JToolBar {
masterVolumePanel = buildMasterVolumeControl();
masterVolumePanel.setVisible(settings.showMasterVolumeSlider);
add(masterVolumePanel);
hostButton = new HostButtonView(pictures);
add(hostButton);
}
/** Shows the selected server's host button; {@code null} hides it. */
void showHostButton(HostButton button) {
hostButton.show(button);
}
/** Reflects the current tab's state on the buttons. */