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

@@ -14,6 +14,7 @@ import com.ts3client.myts.MyTeamSpeakLogin;
import com.ts3client.teamspeak.TeamSpeakImporter;
import com.ts3client.contacts.ContactStore;
import com.ts3client.net.ChannelNode;
import com.ts3client.net.HostButton;
import com.ts3client.net.PictureDownloads;
import com.ts3client.session.SelfState;
import com.ts3client.session.ServerSession;
@@ -368,7 +369,7 @@ public final class MainFrame extends JFrame implements ServerTabPane.Listener {
revalidate();
repaint();
}
});
}, pictures);
}
/** Rebuilds the icon-bearing chrome after the active icon pack changed. */
@@ -460,6 +461,18 @@ public final class MainFrame extends JFrame implements ServerTabPane.Listener {
updateTray();
}
/** The server on {@code tab} may have changed its host button. */
void refreshHostButton(ServerTab tab) {
if (tab == selected) toolbar.showHostButton(hostButtonOf(tab));
}
/** Bookmarks leading to the server on {@code tab} take on its icon. */
void serverIconChanged(ServerTab tab, long iconId) {
if (!bookmarks.rememberServerIcon(tab.session().address(), tab.session().port(), iconId)) return;
bookmarks.save();
menuBar.rebuildBookmarks();
}
/** The local client on {@code tab} started or stopped talking, muted itself, … */
void selfStateChanged(ServerTab tab) {
if (tabs.contains(tab)) updateTray();
@@ -909,10 +922,15 @@ public final class MainFrame extends JFrame implements ServerTabPane.Listener {
boolean away = connected && selected.session().isAway();
boolean commander = connected && selected.session().isCommander();
toolbar.refresh(connected, anyConnected, micMuted, deaf, active, away);
toolbar.showHostButton(hostButtonOf(selected));
menuBar.refresh(connected, away, commander);
updateTray();
}
private static HostButton hostButtonOf(ServerTab tab) {
return tab != null && tab.session().isConnected() ? tab.connection().getModel().hostButton() : null;
}
/**
* The server the tray icon speaks for: the one holding the microphone, or the
* visible one when nobody is capturing.